mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-05 20:10:33 +00:00
feat(password-recovery): Add loader for password recovery - when requests are slow, the UI does not display anything.
This commit is contained in:
@@ -261,19 +261,28 @@
|
||||
ng-switch-when="passwordrecovery">
|
||||
<md-icon class="md-accent md-hue-1 sg-icon--large">vpn_key</md-icon>
|
||||
<div flex="100">
|
||||
<div layout="row" layout-xs="column" class="md-padding">
|
||||
<div layout="row" layout-xs="column" class="md-padding" layout-align="center center">
|
||||
<div ng-if="app.passwordRecovery.showLoader">
|
||||
<md-progress-circular class="md-hue-1"
|
||||
md-mode="indeterminate"
|
||||
md-diameter="32"><!-- password recovery progress --></md-progress-circular>
|
||||
</div>
|
||||
<div ng-if="'SecretQuestion' === app.passwordRecovery.passwordRecoveryMode">
|
||||
{{ app.passwordRecovery.passwordRecoveryQuestion }}
|
||||
<md-input-container class="md-block">
|
||||
<label><var:string label:value="Answer"/></label>
|
||||
<input autocorrect="off" autocapitalize="off" type="text" ng-model="app.passwordRecovery.passwordRecoveryQuestionAnswer" />
|
||||
</md-input-container>
|
||||
<div ng-if="!app.passwordRecovery.showLoader">
|
||||
{{ app.passwordRecovery.passwordRecoveryQuestion }}
|
||||
<md-input-container class="md-block">
|
||||
<label><var:string label:value="Answer"/></label>
|
||||
<input autocorrect="off" autocapitalize="off" type="text" ng-model="app.passwordRecovery.passwordRecoveryQuestionAnswer" />
|
||||
</md-input-container>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="'SecondaryEmail' === app.passwordRecovery.passwordRecoveryMode">
|
||||
{{ app.passwordRecovery.passwordRecoverySecondaryEmailText }}
|
||||
<div ng-if="!app.passwordRecovery.showLoader">
|
||||
{{ app.passwordRecovery.passwordRecoverySecondaryEmailText }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div layout="row" layout-align="end center">
|
||||
<div layout="row" layout-align="end center" ng-if="!app.passwordRecovery.showLoader">
|
||||
<md-button ng-click="app.passwordRecoveryAbort()" type="button" >
|
||||
<var:string label:value="Back"/>
|
||||
</md-button>
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -41,7 +41,8 @@
|
||||
passwordRecoveryToken: null,
|
||||
passwordRecoveryLinkTimer: null,
|
||||
passwordRecoverySecondaryEmailText: null,
|
||||
passwordRecoveryMailDomain: null
|
||||
passwordRecoveryMailDomain: null,
|
||||
showLoader: false
|
||||
};
|
||||
|
||||
// Show login once everything is initialized
|
||||
@@ -219,6 +220,7 @@
|
||||
|
||||
this.passwordRecoveryInfo = function () {
|
||||
vm.loginState = 'passwordrecovery';
|
||||
vm.passwordRecovery.showLoader = true;
|
||||
Authentication.passwordRecovery(this.creds.username, this.creds.domain).then(function (data) {
|
||||
vm.passwordRecovery.passwordRecoveryMode = data.mode;
|
||||
if ('SecretQuestion' === data.mode) {
|
||||
@@ -230,24 +232,30 @@
|
||||
vm.loginState = 'error';
|
||||
vm.errorMessage = l('No password recovery method has been defined for this user');
|
||||
}
|
||||
vm.passwordRecovery.showLoader = false;
|
||||
}, function (msg) {
|
||||
vm.loginState = 'error';
|
||||
vm.errorMessage = msg;
|
||||
vm.passwordRecovery.showLoader = false;
|
||||
});
|
||||
};
|
||||
|
||||
this.passwordRecoveryEmail = function () {
|
||||
vm.passwordRecovery.showLoader = true;
|
||||
Authentication.passwordRecoveryEmail(this.creds.username, this.creds.domain
|
||||
, this.passwordRecovery.passwordRecoveryMode
|
||||
, this.passwordRecovery.passwordRecoveryMailDomain).then(function () {
|
||||
vm.loginState = 'sendrecoverymail';
|
||||
vm.passwordRecovery.showLoader = false;
|
||||
}, function (msg) {
|
||||
vm.loginState = 'error';
|
||||
vm.errorMessage = msg;
|
||||
vm.passwordRecovery.showLoader = false;
|
||||
});
|
||||
};
|
||||
|
||||
this.passwordRecoveryCheck = function () {
|
||||
vm.passwordRecovery.showLoader = true;
|
||||
Authentication.passwordRecoveryCheck(this.creds.username, this.creds.domain
|
||||
, this.passwordRecovery.passwordRecoveryMode
|
||||
, this.passwordRecovery.passwordRecoveryQuestionKey
|
||||
@@ -259,9 +267,11 @@
|
||||
} else if ("SecondaryEmail" == vm.passwordRecovery.passwordRecoveryMode) {
|
||||
vm.loginState = 'sendrecoverymail';
|
||||
}
|
||||
vm.passwordRecovery.showLoader = false;
|
||||
}, function (msg) {
|
||||
vm.loginState = 'error';
|
||||
vm.errorMessage = msg;
|
||||
vm.passwordRecovery.showLoader = false;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -281,6 +291,7 @@
|
||||
this.passwordRecovery.passwordRecoveryToken = null;
|
||||
this.passwordRecovery.passwordRecoverySecondaryEmailText = null;
|
||||
this.passwordRecovery.passwordRecoveryMailDomain = null;
|
||||
this.passwordRecovery.showLoader = false;
|
||||
$window.location.reload(true);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user