mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-23 19:28:54 +00:00
feat(password-recovery): Add password recovery with secret question or secondary email
This commit is contained in:
1 parent
6931186bba
commit
656807b77d
47 files changed
+1729
-159
No files matched your search
@@ -1,2 +1,2 @@
|
||||
!function(){"use strict";function o(o,s,e,n,i,r,t){var a=this;this.$onInit=function(){this.creds={username:s.cookieUsername,password:null,domain:null,rememberLogin:angular.isDefined(s.cookieUsername)&&0<s.cookieUsername.length},/\blanguage=/.test(s.location.search)&&(this.creds.language=s.language),this.loginState=!1,this.verificationCodePattern="\\d{6}",this.passwords={newPassword:null,newPasswordConfirmation:null,oldPassword:null},this.showLogin=!1,e(function(){a.showLogin=!0},100)},this.login=function(){return a.loginState="authenticating",r.login(a.creds).then(function(o){o.totpmissingkey?(a.loginState="totpcode",t("totpcode")):o.totpdisabled?(a.loginState="totpdisabled",a.cn=o.cn,a.url=o.url):(a.loginState="logged",a.cn=o.cn,a.url=o.url,e(function(){a.continueLogin()},1e3))},function(o){var s,e;a.loginState="error",o.error?a.errorMessage=o.error:0<o.grace?(a.loginState="passwordwillexpire",a.cn=o.cn,a.url=o.url,a.errorMessage=l("You have %{0} logins remaining before your account is locked. Please change your password in the preference dialog.",o.grace)):0<o.expire?(e=86400<o.expire?(s=Math.round(o.expire/86400),l("days")):3600<o.expire?(s=Math.round(o.expire/3600),l("hours")):60<o.expire?(s=Math.round(o.expire/60),l("minutes")):(s=o.expire,l("seconds")),a.loginState="passwordwillexpire",a.cn=o.cn,a.url=o.url,a.errorMessage=l("Your password is going to expire in %{0} %{1}.",s,e)):o.passwordexpired&&(a.loginState="passwordexpired",a.url=o.url)}),!1},this.restoreLogin=function(){a.loginState=!1,delete a.creds.verificationCode},this.continueLogin=function(){s.location.href===a.url?s.location.reload(!0):s.location.href=a.url},this.showAbout=function(o){function s(o){this.closeDialog=function(){o.hide()}}i.show({targetEvent:o,templateUrl:"aboutBox.html",controller:s,controllerAs:"about"}),s.$inject=["$mdDialog"]},this.changeLanguage=function(o){s.location.href=ApplicationBaseURL+"login?language="+this.creds.language},this.canChangePassword=function(o){return this.passwords.newPasswordConfirmation&&this.passwords.newPasswordConfirmation.length&&this.passwords.newPassword!=this.passwords.newPasswordConfirmation?(o.newPasswordConfirmation.$setValidity("newPasswordMismatch",!1),!1):(o.newPasswordConfirmation.$setValidity("newPasswordMismatch",!0),!!(this.passwords.newPassword&&0<this.passwords.newPassword.length&&this.passwords.newPasswordConfirmation&&this.passwords.newPasswordConfirmation.length&&this.passwords.newPassword==this.passwords.newPasswordConfirmation&&this.passwords.oldPassword&&0<this.passwords.oldPassword.length))},this.changePassword=function(){r.changePassword(this.creds.username,this.creds.domain,this.passwords.newPassword,this.passwords.oldPassword).then(function(o){a.loginState="message",a.url=o.url,a.errorMessage=l("The password was changed successfully.")},function(o){a.loginState="error",a.errorMessage=o})}}angular.module("SOGo.MainUI",["SOGo.Common","SOGo.Authentication"]),o.$inject=["$scope","$window","$timeout","Dialog","$mdDialog","Authentication","sgFocus"],angular.module("SOGo.MainUI").controller("LoginController",o)}();
|
||||
!function(){"use strict";angular.module("SOGo.MainUI",["SOGo.Common","SOGo.Authentication"]);function e(e,o,s,r,n,a,i,t){var d=this;this.$onInit=function(){this.creds={username:o.cookieUsername,password:null,domain:null,rememberLogin:angular.isDefined(o.cookieUsername)&&0<o.cookieUsername.length},/\blanguage=/.test(o.location.search)&&(this.creds.language=o.language),this.loginState=!1,this.verificationCodePattern="\\d{6}",this.passwords={newPassword:null,newPasswordConfirmation:null,oldPassword:null},this.passwordRecovery={passwordRecoveryEnabled:!1,passwordRecoveryQuestionKey:null,passwordRecoveryQuestion:null,passwordRecoveryMode:null,passwordRecoveryQuestionAnswer:null,passwordRecoveryToken:null,passwordRecoveryLinkTimer:null,passwordRecoverySecondaryEmailText:null,passwordRecoveryMailDomain:null},this.showLogin=!1,s(function(){d.showLogin=!0;var e=window.location.search;const o=new URLSearchParams(e);let s=o.get("token");0<window.location.pathname.indexOf("passwordRecoveryEmail")&&s?3===(e=(s=s.replace(/\//g,"")).split(".")).length&&(d.passwordRecovery.passwordRecoveryToken=s,e=JSON.parse(atob(e[1])),d.creds.username=e.username,d.creds.domain=e.domain,d.passwordRecovery.passwordRecoveryToken=s,d.passwordRecovery.passwordRecoveryMode="SecondaryEmail",d.passwordRecovery.passwordRecoveryEnabled=!0,d.loginState="passwordchange",d.showLogin=!1,t("loginContent")):d.retrievePasswordRecoveryEnabled()},100)},this.login=function(){return d.loginState="authenticating",a.login(d.creds).then(function(e){e.totpmissingkey?(d.loginState="totpcode",i("totpcode")):e.totpdisabled?(d.loginState="totpdisabled",d.cn=e.cn,d.url=e.url):(d.loginState="logged",d.cn=e.cn,d.url=e.url,s(function(){d.continueLogin()},1e3))},function(e){var o,s;d.loginState="error",e.error?d.errorMessage=e.error:0<e.grace?(d.loginState="passwordwillexpire",d.cn=e.cn,d.url=e.url,d.errorMessage=l("You have %{0} logins remaining before your account is locked. Please change your password in the preference dialog.",e.grace)):0<e.expire?(s=86400<e.expire?(o=Math.round(e.expire/86400),l("days")):3600<e.expire?(o=Math.round(e.expire/3600),l("hours")):60<e.expire?(o=Math.round(e.expire/60),l("minutes")):(o=e.expire,l("seconds")),d.loginState="passwordwillexpire",d.cn=e.cn,d.url=e.url,d.errorMessage=l("Your password is going to expire in %{0} %{1}.",o,s)):e.passwordexpired&&(d.loginState="passwordchange",d.url=e.url)}),!1},this.restoreLogin=function(){d.loginState=!1,delete d.creds.verificationCode,d.isInPasswordRecoveryMode()&&d.passwordRecoveryAbort()},this.continueLogin=function(){o.location.href===d.url?o.location.reload(!0):o.location.href=d.url},this.showAbout=function(e){function o(e){this.closeDialog=function(){e.hide()}}n.show({targetEvent:e,templateUrl:"aboutBox.html",controller:o,controllerAs:"about"}),o.$inject=["$mdDialog"]},this.changeLanguage=function(e){o.location.href=ApplicationBaseURL+"login?language="+this.creds.language},this.hello=function(e){return!1},this.canChangePassword=function(e){return this.passwords.newPasswordConfirmation&&this.passwords.newPasswordConfirmation.length&&this.passwords.newPassword!=this.passwords.newPasswordConfirmation?(e.newPasswordConfirmation.$setValidity("newPasswordMismatch",!1),!1):(e.newPasswordConfirmation.$setValidity("newPasswordMismatch",!0),!!(this.passwords.newPassword&&0<this.passwords.newPassword.length&&this.passwords.newPasswordConfirmation&&this.passwords.newPasswordConfirmation.length&&this.passwords.newPassword==this.passwords.newPasswordConfirmation&&(this.isInPasswordRecoveryMode()||!this.loginState&&this.passwords.oldPassword&&0<this.passwords.oldPassword.length)))},this.changePassword=function(){a.changePassword(this.creds.username,this.creds.domain,this.passwords.newPassword,this.passwords.oldPassword,this.passwordRecovery.passwordRecoveryToken).then(function(e){d.loginState="message",d.url=e.url,d.errorMessage=l("The password was changed successfully.")},function(e){d.loginState="error",d.errorMessage=e})},this.passwordRecoveryInfo=function(){d.loginState="passwordrecovery",a.passwordRecovery(this.creds.username,this.creds.domain).then(function(e){d.passwordRecovery.passwordRecoveryMode=e.mode,"SecretQuestion"===e.mode?(d.passwordRecovery.passwordRecoveryQuestion=e.secretQuestionLabel,d.passwordRecovery.passwordRecoveryQuestionKey=e.secretQuestion):"SecondaryEmail"===e.mode?d.passwordRecovery.passwordRecoverySecondaryEmailText=l("A link will be sent to %{0}",e.obfuscatedRecoveryEmail):"Disabled"===e.mode&&(d.loginState="error",d.errorMessage=l("No password recovery method has been defined for this user"))},function(e){d.loginState="error",d.errorMessage=e})},this.passwordRecoveryEmail=function(){a.passwordRecoveryEmail(this.creds.username,this.creds.domain,this.passwordRecovery.passwordRecoveryMode,this.passwordRecovery.passwordRecoveryMailDomain).then(function(){d.loginState="sendrecoverymail"},function(e){d.loginState="error",d.errorMessage=e})},this.passwordRecoveryCheck=function(){Line truncated
|
||||
//# sourceMappingURL=Main.js.map
|
||||
Reference in new issue
Block a user