mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-16 13:54:54 +00:00
feat(preferences): Improve TOTP - add validation code in preferences before saving to ensure user add qr code in totp application
This commit is contained in:
@@ -456,8 +456,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
if (sendForm)
|
||||
if (sendForm) {
|
||||
var self = this;
|
||||
return this.preferences.$save().then(function(data) {
|
||||
self.preferences.defaults.totpVerificationCode = ''
|
||||
if (!options || !options.quick) {
|
||||
$mdToast.show(
|
||||
$mdToast.simple()
|
||||
@@ -466,11 +468,20 @@
|
||||
.hideDelay(2000));
|
||||
form.$setPristine();
|
||||
}
|
||||
}).catch(function(e) {
|
||||
if (485 == e.status) {
|
||||
form.totpVerificationCode.$setValidity('invalidTotpCode', false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return $q.reject('Invalid form');
|
||||
};
|
||||
|
||||
this.resetTotpVerificationCode = function(form) {
|
||||
form.totpVerificationCode.$setValidity('invalidTotpCode', true);
|
||||
}
|
||||
|
||||
this.canChangePassword = function(form) {
|
||||
if (this.passwords.newPasswordConfirmation && this.passwords.newPasswordConfirmation.length &&
|
||||
this.passwords.newPassword != this.passwords.newPasswordConfirmation) {
|
||||
|
||||
Reference in New Issue
Block a user