Avoid showing the email input when viewing the full affiliations UI; disable affiliations when using SAML and LDAP authentication strategies.

This commit is contained in:
Paulo Reis
2018-07-12 16:37:09 +01:00
committed by James Allen
parent c817094a2d
commit 85cf518457
2 changed files with 23 additions and 20 deletions
@@ -20,5 +20,7 @@ module.exports = Features =
return Settings.overleaf? return Settings.overleaf?
when 'templates' when 'templates'
return !Settings.overleaf? return !Settings.overleaf?
when 'affiliations'
return !(Settings.ldap? or Settings.saml?)
else else
throw new Error("unknown feature: #{feature}") throw new Error("unknown feature: #{feature}")
+21 -20
View File
@@ -9,7 +9,7 @@ block content
.page-header .page-header
h1 #{translate("account_settings")} h1 #{translate("account_settings")}
.account-settings(ng-controller="AccountSettingsController", ng-cloak) .account-settings(ng-controller="AccountSettingsController", ng-cloak)
if locals.showAffiliationsUI if locals.showAffiliationsUI && hasFeature('affiliations')
include settings/user-affiliations include settings/user-affiliations
form-messages(for="settingsForm") form-messages(for="settingsForm")
@@ -22,25 +22,26 @@ block content
h3 #{translate("update_account_info")} h3 #{translate("update_account_info")}
form(async-form="settings", name="settingsForm", method="POST", action="/user/settings", novalidate) form(async-form="settings", name="settingsForm", method="POST", action="/user/settings", novalidate)
input(type="hidden", name="_csrf", value=csrfToken) input(type="hidden", name="_csrf", value=csrfToken)
if !externalAuthenticationSystemUsed() if !(locals.showAffiliationsUI && hasFeature('affiliations'))
.form-group if !externalAuthenticationSystemUsed()
label(for='email') #{translate("email")} .form-group
input.form-control( label(for='email') #{translate("email")}
type='email', input.form-control(
name='email', type='email',
placeholder="email@example.com" name='email',
required, placeholder="email@example.com"
ng-model="email", required,
ng-init="email = "+JSON.stringify(user.email), ng-model="email",
ng-model-options="{ updateOn: 'blur' }" ng-init="email = "+JSON.stringify(user.email),
) ng-model-options="{ updateOn: 'blur' }"
span.small.text-primary(ng-show="settingsForm.email.$invalid && settingsForm.email.$dirty") )
| #{translate("must_be_email_address")} span.small.text-primary(ng-show="settingsForm.email.$invalid && settingsForm.email.$dirty")
else | #{translate("must_be_email_address")}
// show the email, non-editable else
.form-group // show the email, non-editable
label.control-label #{translate("email")} .form-group
div.form-control(readonly="true") #{user.email} label.control-label #{translate("email")}
div.form-control(readonly="true") #{user.email}
if shouldAllowEditingDetails if shouldAllowEditingDetails
.form-group .form-group