feat(password-recovery): Add loader for password recovery - when requests are slow, the UI does not display anything.

This commit is contained in:
smizrahi committed 2022-10-26 16:23:55 +02:00
1 parent 7444865544
commit 18c92dac31
4 files changed
+31 -11

No files matched your search

+12 -1
View File
@@ -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);
};