Skip to content

Commit

Permalink
Merge pull request #237 from sandrinodimattia/support-password-change…
Browse files Browse the repository at this point in the history
…-required

Support password change required
  • Loading branch information
cristiandouce committed Oct 8, 2015
2 parents 259de39 + d16ddcd commit 1445107
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
51 changes: 26 additions & 25 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,32 @@
"signupSocialButton": "Signup with {connection:title}",
"networkError": "We could not reach the server.<br/>Please try again.",
"signin": {
"title": "Log in",
"action": "Access",
"actionDomain": "Log in to {domain}",
"all": "Show all",
"strategyEmailEmpty": "The email is empty.",
"strategyEmailInvalid": "The email is invalid.",
"strategyDomainInvalid": "The domain {domain} has not been set up.",
"signupText": "Sign Up",
"forgotText": "Reset password",
"cancelAction": "Cancel",
"footerText": "",
"emailPlaceholder": "Email",
"usernamePlaceholder": "Username",
"passwordPlaceholder": "Password",
"separatorText": "or",
"serverErrorText": "There was an error processing the login.",
"returnUserLabel": "Last time you signed in using...",
"domainUserLabel": "You are connected from your corporate network...",
"wrongEmailPasswordErrorText": "Wrong email or password.",
"unauthorizedErrorText": "Access denied.",
"or": "... or log in using",
"loadingMessage": "Logging In with {connection}...",
"popupCredentials": "Enter your credentials in the pop-up window",
"userClosedPopup": "Popup window closed. Try again.",
"userConsentFailed": "Permissions were not granted. Try again."
"title": "Log in",
"action": "Access",
"actionDomain": "Log in to {domain}",
"all": "Show all",
"strategyEmailEmpty": "The email is empty.",
"strategyEmailInvalid": "The email is invalid.",
"strategyDomainInvalid": "The domain {domain} has not been set up.",
"signupText": "Sign Up",
"forgotText": "Reset password",
"cancelAction": "Cancel",
"footerText": "",
"emailPlaceholder": "Email",
"usernamePlaceholder": "Username",
"passwordPlaceholder": "Password",
"separatorText": "or",
"serverErrorText": "There was an error processing the login.",
"returnUserLabel": "Last time you signed in using...",
"domainUserLabel": "You are connected from your corporate network...",
"wrongEmailPasswordErrorText": "Wrong email or password.",
"passwordChangeRequiredErrorText": "You need to update your password because this is the first time you are signing in, or because your password has expired.",
"unauthorizedErrorText": "Access denied.",
"or": "... or log in using",
"loadingMessage": "Logging In with {connection}...",
"popupCredentials": "Enter your credentials in the pop-up window",
"userClosedPopup": "Popup window closed. Try again.",
"userConsentFailed": "Permissions were not granted. Try again."
},
"signup": {
"description": "",
Expand Down
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,8 @@ Auth0Lock.prototype._signinWithAuth0 = function (panel, connection) {

if (err.status !== 401) {
self._showError(err.message || self.options.i18n.t('signin:serverErrorText'));
} else if ('password_change_required' === err.code) {
self._showError(self.options.i18n.t('signin:passwordChangeRequiredErrorText'));
} else {
self._showError(self.options.i18n.t('signin:wrongEmailPasswordErrorText'));
}
Expand Down Expand Up @@ -1273,6 +1275,11 @@ Auth0Lock.prototype._signinPopupNoRedirect = function (connectionName, popupCall
self._showError((err.details && err.details.error_description) || message);
self._focusError(email_input);
self._focusError(password_input);
} else if ('password_change_required' === err.code) {
var message = self.options.i18n.t('signin:passwordChangeRequiredErrorText');
self._showError(message);
self._focusError(email_input);
self._focusError(password_input);
} else {
var message = self.options.i18n.t('signin:wrongEmailPasswordErrorText');
self._showError(message);
Expand Down

0 comments on commit 1445107

Please sign in to comment.