From 0ecda4e093911515171c50c3306e7c98e12fd666 Mon Sep 17 00:00:00 2001 From: Douglas Lovell Date: Mon, 10 Sep 2018 14:53:33 -0300 Subject: [PATCH 1/4] Display password change from in Account Settings --- services/web/app/views/user/settings.pug | 103 ++++++++++------------- 1 file changed, 46 insertions(+), 57 deletions(-) diff --git a/services/web/app/views/user/settings.pug b/services/web/app/views/user/settings.pug index b6f4818d7f..9681da50f4 100644 --- a/services/web/app/views/user/settings.pug +++ b/services/web/app/views/user/settings.pug @@ -33,7 +33,7 @@ block content required, ng-model="email", ng-init="email = "+JSON.stringify(user.email), - ng-model-options="{ updateOn: 'blur' }" + ng-model-options="{ pdateOn: 'blur' }" ) span.small.text-primary(ng-show="settingsForm.email.$invalid && settingsForm.email.$dirty") | #{translate("must_be_email_address")} @@ -73,62 +73,51 @@ block content 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")} - - else - if settings.overleaf && settings.createV1AccountOnLogin - .col-md-5.col-md-offset-1 - h3 #{translate("change_password")} - p - | To change your password, - | please go to #[a(href=settings.overleaf.host+'/users/edit') Overleaf v1 settings] - + .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")} | !{moduleIncludes("userSettings", locals)} From 7d10e64840c46689187d6af111a5bcc0637cec99 Mon Sep 17 00:00:00 2001 From: Douglas Lovell Date: Fri, 14 Sep 2018 16:19:02 -0300 Subject: [PATCH 2/4] Alter endpoint for account settings, change password form submission. --- services/web/app/views/user/settings.pug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/app/views/user/settings.pug b/services/web/app/views/user/settings.pug index 9681da50f4..497de3a01d 100644 --- a/services/web/app/views/user/settings.pug +++ b/services/web/app/views/user/settings.pug @@ -75,7 +75,7 @@ block content .col-md-5.col-md-offset-1 h3 #{translate("change_password")} - form(async-form="changepassword", name="changePasswordForm", action="/user/password/update", method="POST", novalidate) + form(async-form="changepassword", name="changePasswordForm", action="/change_password/v1", method="POST", novalidate) input(type="hidden", name="_csrf", value=csrfToken) .form-group label(for='currentPassword') #{translate("current_password")} From 4abbc5d5697fa333609d824bf726b37997071861 Mon Sep 17 00:00:00 2001 From: Douglas Lovell Date: Tue, 18 Sep 2018 09:10:33 -0300 Subject: [PATCH 3/4] Password change form conditioned on installation --- services/web/app/views/user/settings.pug | 101 +++++++++++++---------- 1 file changed, 58 insertions(+), 43 deletions(-) diff --git a/services/web/app/views/user/settings.pug b/services/web/app/views/user/settings.pug index 497de3a01d..3d7692dd7c 100644 --- a/services/web/app/views/user/settings.pug +++ b/services/web/app/views/user/settings.pug @@ -75,49 +75,64 @@ block content .col-md-5.col-md-offset-1 h3 #{translate("change_password")} - form(async-form="changepassword", name="changePasswordForm", action="/change_password/v1", 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")} + if externalAuthenticationSystemUsed() && !settings.overleaf + p + Password settings are managed externally to Overleaf + else + - var submitAction + if settings.overleaf + - submitAction = '/change_password/v1' + else + - submitAction = '/user/password/update' + form( + async-form="changepassword" + name="changePasswordForm" + action=submitAction + 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")} | !{moduleIncludes("userSettings", locals)} From 98be2c2bf55b97d1a616c12013019fec0348f4e3 Mon Sep 17 00:00:00 2001 From: Douglas Lovell Date: Wed, 19 Sep 2018 07:58:04 -0300 Subject: [PATCH 4/4] Update wording and endpoint for change password form --- services/web/app/views/user/settings.pug | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/app/views/user/settings.pug b/services/web/app/views/user/settings.pug index 3d7692dd7c..b66d82e044 100644 --- a/services/web/app/views/user/settings.pug +++ b/services/web/app/views/user/settings.pug @@ -77,11 +77,11 @@ block content h3 #{translate("change_password")} if externalAuthenticationSystemUsed() && !settings.overleaf p - Password settings are managed externally to Overleaf + Password settings are managed externally else - var submitAction if settings.overleaf - - submitAction = '/change_password/v1' + - submitAction = '/user/change_password/v1' else - submitAction = '/user/password/update' form(