Merge pull request #3358 from overleaf/jel-send-email-confirmation-error

Handle errors in dash UI when resending email confirmation

GitOrigin-RevId: 560e229845b72987a8d7132d87506cfb58323232
This commit is contained in:
Simon Detheridge 2020-11-09 10:35:18 +00:00 committed by Copybot
parent 8e20258786
commit 6a3e697396
2 changed files with 29 additions and 19 deletions

View file

@ -174,19 +174,22 @@ include ../../_mixins/saml
ng-repeat="userEmail in userEmails",
ng-if="showConfirmEmail(userEmail) && projects.length > 0"
)
.alert.alert-warning(ng-if="!userEmail.confirmationInflight")
.alert.alert-warning
.notification-body
| #{translate("please_confirm_email", {emailAddress: "{{ userEmail.email }}"})}
|
a(
href
ng-click="resendConfirmationEmail(userEmail)"
) (#{translate('resend_confirmation_email')})
.alert.alert-warning(ng-if="userEmail.confirmationInflight")
.notification-body
i.fa.fa-spinner.fa-spin(aria-hidden="true")
|
| #{translate('resending_confirmation_email')}…
div(ng-if="!userEmail.confirmationInflight")
| #{translate("please_confirm_email", {emailAddress: "{{ userEmail.email }}"})}
|
a(
href
ng-click="resendConfirmationEmail(userEmail)"
) (#{translate('resend_confirmation_email')})
div(ng-if="userEmail.confirmationInflight")
i.fa.fa-spinner.fa-spin(aria-hidden="true")
|
| #{translate('resending_confirmation_email')}…
div(ng-if="!userEmail.confirmationInflight && userEmail.error" aria-live="polite")
| #{translate('generic_something_went_wrong')}
- var hasPaidAffiliation = userAffiliations.some(affiliation => affiliation.licence && affiliation.licence !== 'free')
if settings.enableSubscriptions && !hasSubscription && !hasPaidAffiliation
ul.list-unstyled(

View file

@ -112,12 +112,19 @@ App.controller('EmailNotificationController', function(
$scope.resendConfirmationEmail = function(userEmail) {
userEmail.confirmationInflight = true
return UserAffiliationsDataService.resendConfirmationEmail(
userEmail.email
).then(function() {
userEmail.hide = true
userEmail.confirmationInflight = false
$scope.$emit('project-list:notifications-received')
})
userEmail.error = false
UserAffiliationsDataService.resendConfirmationEmail(userEmail.email)
.then(() => {
userEmail.hide = true
$scope.$emit('project-list:notifications-received')
})
.catch(error => {
userEmail.error = true
console.error(error)
$scope.$emit('project-list:notifications-received')
})
.finally(() => {
userEmail.confirmationInflight = false
})
}
})