Hide affiliations UI behind feature flag.

This commit is contained in:
Paulo Reis 2018-06-25 17:06:23 +01:00
parent 8ac6f4d6f4
commit e7f819fbdd
3 changed files with 110 additions and 106 deletions

View file

@ -68,6 +68,7 @@ module.exports =
shouldAllowEditingDetails: shouldAllowEditingDetails shouldAllowEditingDetails: shouldAllowEditingDetails
languages: Settings.languages, languages: Settings.languages,
accountSettingsTabActive: true accountSettingsTabActive: true
showAffiliationsUI: (req.query?.aff == "true") or false
sessionsPage: (req, res, next) -> sessionsPage: (req, res, next) ->
user = AuthenticationController.getSessionUser(req) user = AuthenticationController.getSessionUser(req)

View file

@ -9,11 +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)
form-messages(for="settingsForm") if locals.showAffiliationsUI
.alert.alert-success(ng-show="settingsForm.response.success")
| #{translate("thanks_settings_updated")}
form-messages(for="changePasswordForm")
div
form.row( form.row(
ng-controller="UserAffiliationsController" ng-controller="UserAffiliationsController"
name="affiliationsForm" name="affiliationsForm"
@ -184,108 +180,112 @@ block content
i.fa.fa-fw.fa-spin.fa-refresh i.fa.fa-fw.fa-spin.fa-refresh
|  Adding... |  Adding...
hr hr
form-messages(for="settingsForm")
.alert.alert-success(ng-show="settingsForm.response.success")
| #{translate("thanks_settings_updated")}
form-messages(for="changePasswordForm")
.row .row
.col-md-5 .col-md-5
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)
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
label(for='firstName').control-label #{translate("first_name")}
input.form-control(
type='text',
name='first_name',
value=user.first_name
ng-non-bindable
)
.form-group
label(for='lastName').control-label #{translate("last_name")}
input.form-control(
type='text',
name='last_name',
value=user.last_name
ng-non-bindable
)
.actions
button.btn.btn-primary(
type='submit',
ng-disabled="settingsForm.$invalid"
) #{translate("update")}
else
.form-group
label.control-label #{translate("first_name")}
div.form-control(readonly="true") #{user.first_name}
.form-group
label.control-label #{translate("last_name")}
div.form-control(readonly="true") #{user.last_name}
if !externalAuthenticationSystemUsed()
.col-md-5.col-md-offset-1
h3 #{translate("change_password")}
form(async-form="changepassword", name="changePasswordForm", action="/user/password/update", method="POST", novalidate)
input(type="hidden", name="_csrf", value=csrfToken) input(type="hidden", name="_csrf", value=csrfToken)
if !externalAuthenticationSystemUsed() .form-group
.form-group label(for='currentPassword') #{translate("current_password")}
label(for='email') #{translate("email")} input.form-control(
input.form-control( type='password',
type='email', name='currentPassword',
name='email', placeholder='*********',
placeholder="email@example.com" ng-model="currentPassword",
required, required
ng-model="email", )
ng-init="email = "+JSON.stringify(user.email), span.small.text-primary(ng-show="changePasswordForm.currentPassword.$invalid && changePasswordForm.currentPassword.$dirty")
ng-model-options="{ updateOn: 'blur' }" | #{translate("required")}
) .form-group
span.small.text-primary(ng-show="settingsForm.email.$invalid && settingsForm.email.$dirty") label(for='newPassword1') #{translate("new_password")}
| #{translate("must_be_email_address")} input.form-control(
else id='passwordField',
// show the email, non-editable type='password',
.form-group name='newPassword1',
label.control-label #{translate("email")} placeholder='*********',
div.form-control(readonly="true") #{user.email} ng-model="newPassword1",
required,
if shouldAllowEditingDetails complex-password
.form-group )
label(for='firstName').control-label #{translate("first_name")} span.small.text-primary(ng-show="changePasswordForm.newPassword1.$error.complexPassword && changePasswordForm.newPassword1.$dirty", ng-bind-html="complexPasswordErrorMessage")
input.form-control( .form-group
type='text', label(for='newPassword2') #{translate("confirm_new_password")}
name='first_name', input.form-control(
value=user.first_name type='password',
ng-non-bindable name='newPassword2',
) placeholder='*********',
.form-group ng-model="newPassword2",
label(for='lastName').control-label #{translate("last_name")} equals="passwordField"
input.form-control( )
type='text', span.small.text-primary(ng-show="changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$dirty")
name='last_name', | #{translate("doesnt_match")}
value=user.last_name span.small.text-primary(ng-show="!changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$invalid && changePasswordForm.newPassword2.$dirty")
ng-non-bindable | #{translate("invalid_password")}
) .actions
.actions button.btn.btn-primary(
button.btn.btn-primary( type='submit',
type='submit', ng-disabled="changePasswordForm.$invalid"
ng-disabled="settingsForm.$invalid" ) #{translate("change")}
) #{translate("update")}
else
.form-group
label.control-label #{translate("first_name")}
div.form-control(readonly="true") #{user.first_name}
.form-group
label.control-label #{translate("last_name")}
div.form-control(readonly="true") #{user.last_name}
if !externalAuthenticationSystemUsed()
.col-md-5.col-md-offset-1
h3 #{translate("change_password")}
form(async-form="changepassword", name="changePasswordForm", action="/user/password/update", method="POST", novalidate)
input(type="hidden", name="_csrf", value=csrfToken)
.form-group
label(for='currentPassword') #{translate("current_password")}
input.form-control(
type='password',
name='currentPassword',
placeholder='*********',
ng-model="currentPassword",
required
)
span.small.text-primary(ng-show="changePasswordForm.currentPassword.$invalid && changePasswordForm.currentPassword.$dirty")
| #{translate("required")}
.form-group
label(for='newPassword1') #{translate("new_password")}
input.form-control(
id='passwordField',
type='password',
name='newPassword1',
placeholder='*********',
ng-model="newPassword1",
required,
complex-password
)
span.small.text-primary(ng-show="changePasswordForm.newPassword1.$error.complexPassword && changePasswordForm.newPassword1.$dirty", ng-bind-html="complexPasswordErrorMessage")
.form-group
label(for='newPassword2') #{translate("confirm_new_password")}
input.form-control(
type='password',
name='newPassword2',
placeholder='*********',
ng-model="newPassword2",
equals="passwordField"
)
span.small.text-primary(ng-show="changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$dirty")
| #{translate("doesnt_match")}
span.small.text-primary(ng-show="!changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$invalid && changePasswordForm.newPassword2.$dirty")
| #{translate("invalid_password")}
.actions
button.btn.btn-primary(
type='submit',
ng-disabled="changePasswordForm.$invalid"
) #{translate("change")}

View file

@ -2,6 +2,9 @@
.alert { .alert {
margin-bottom: 0; margin-bottom: 0;
} }
h3 {
margin-top: 0;
}
} }
#delete-account-modal { #delete-account-modal {