-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update password reset handler to handle password policy error (#1047)
* Update password reset handler to handle 'PASSWORD_DOES_NOT_MEET_REQUIREMENTS' error * Update the translations * pin chrome 114 to run tests * Unpin chrome 114
- Loading branch information
Showing
48 changed files
with
1,136 additions
and
678 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,6 +201,79 @@ function testHandlePasswordReset_weakPasswordError() { | |
} | ||
|
||
|
||
function testHandlePasswordReset_nonCompliantPasswordError() { | ||
const errorMessage = 'Missing password requirements: [Password may contain at most 16 characters, Password must contain a lower case character, Password must contain an upper case character, Password must contain a numeric character, Password must contain a non-alphanumeric character]'; | ||
const error = { | ||
'code': 'auth/password-does-not-meet-requirements', | ||
'message': errorMessage | ||
}; | ||
asyncTestCase.waitForSignals(1); | ||
firebaseui.auth.widget.handler.handlePasswordReset( | ||
app, container, 'PASSWORD_RESET_ACTION_CODE'); | ||
// Successful action code verification. | ||
app.getAuth().assertVerifyPasswordResetCode( | ||
['PASSWORD_RESET_ACTION_CODE'], '[email protected]'); | ||
app.getAuth() | ||
.process() | ||
.then(function() { | ||
// Password reset page should show. | ||
assertPasswordResetPage(); | ||
|
||
goog.dom.forms.setValue(getNewPasswordElement(), '123'); | ||
// Submit password reset form. | ||
submitForm(); | ||
// Simulates password doesn't meet requirements. | ||
app.getAuth().assertConfirmPasswordReset( | ||
['PASSWORD_RESET_ACTION_CODE', '123'], null, error); | ||
return app.getAuth().process(); | ||
}) | ||
.then(function() { | ||
// Error message should be shown on the same page. | ||
assertPasswordResetPage(); | ||
assertEquals( | ||
firebaseui.auth.widget.handler.common.getErrorMessage(error), | ||
getNewPasswordErrorMessage()); | ||
asyncTestCase.signal(); | ||
}); | ||
} | ||
|
||
|
||
function testHandlePasswordReset_nonCompliantPassword_emptyError() { | ||
const error = { | ||
'code': 'auth/password-does-not-meet-requirements', | ||
'message': '' | ||
}; | ||
asyncTestCase.waitForSignals(1); | ||
firebaseui.auth.widget.handler.handlePasswordReset( | ||
app, container, 'PASSWORD_RESET_ACTION_CODE'); | ||
// Successful action code verification. | ||
app.getAuth().assertVerifyPasswordResetCode( | ||
['PASSWORD_RESET_ACTION_CODE'], '[email protected]'); | ||
app.getAuth() | ||
.process() | ||
.then(function() { | ||
// Password reset page should show. | ||
assertPasswordResetPage(); | ||
|
||
goog.dom.forms.setValue(getNewPasswordElement(), '123'); | ||
// Submit password reset form. | ||
submitForm(); | ||
// Simulates password doesn't meet requirements. | ||
app.getAuth().assertConfirmPasswordReset( | ||
['PASSWORD_RESET_ACTION_CODE', '123'], null, error); | ||
return app.getAuth().process(); | ||
}) | ||
.then(function() { | ||
// Error message should be shown on the same page. | ||
assertPasswordResetPage(); | ||
assertEquals( | ||
firebaseui.auth.widget.handler.common.getErrorMessage(error), | ||
getNewPasswordErrorMessage()); | ||
asyncTestCase.signal(); | ||
}); | ||
} | ||
|
||
|
||
function testHandlePasswordReset_failToResetPassword() { | ||
asyncTestCase.waitForSignals(1); | ||
firebaseui.auth.widget.handler.handlePasswordReset( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.