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-05 17:26:12 +01:00 committed by James Allen
parent c817094a2d
commit 85cf518457
2 changed files with 23 additions and 20 deletions

View file

@ -20,5 +20,7 @@ module.exports = Features =
return Settings.overleaf?
when 'templates'
return !Settings.overleaf?
when 'affiliations'
return !(Settings.ldap? or Settings.saml?)
else
throw new Error("unknown feature: #{feature}")

View file

@ -9,7 +9,7 @@ block content
.page-header
h1 #{translate("account_settings")}
.account-settings(ng-controller="AccountSettingsController", ng-cloak)
if locals.showAffiliationsUI
if locals.showAffiliationsUI && hasFeature('affiliations')
include settings/user-affiliations
form-messages(for="settingsForm")
@ -22,25 +22,26 @@ block content
h3 #{translate("update_account_info")}
form(async-form="settings", name="settingsForm", method="POST", action="/user/settings", novalidate)
input(type="hidden", name="_csrf", value=csrfToken)
if !externalAuthenticationSystemUsed()
.form-group
label(for='email') #{translate("email")}
input.form-control(
type='email',
name='email',
placeholder="email@example.com"
required,
ng-model="email",
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")}
else
// show the email, non-editable
.form-group
label.control-label #{translate("email")}
div.form-control(readonly="true") #{user.email}
if !(locals.showAffiliationsUI && hasFeature('affiliations'))
if !externalAuthenticationSystemUsed()
.form-group
label(for='email') #{translate("email")}
input.form-control(
type='email',
name='email',
placeholder="email@example.com"
required,
ng-model="email",
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")}
else
// show the email, non-editable
.form-group
label.control-label #{translate("email")}
div.form-control(readonly="true") #{user.email}
if shouldAllowEditingDetails
.form-group