Skip to content
Snippets Groups Projects
Commit e6fd5051 authored by Lloyd Hilaiel's avatar Lloyd Hilaiel
Browse files

Merge pull request #1696 from mozilla/issue_1540_clear_password

Clear the password if the user types a password then changes the email address.
parents 23dfa1d3 1d0cca25
No related branches found
No related tags found
No related merge requests found
......@@ -120,6 +120,8 @@ BrowserID.Modules.Authenticate = (function() {
function enterPasswordState(callback) {
var self=this;
dom.setInner("#password", "");
self.publish("enter_password", addressInfo);
self.submit = authenticate;
showHint("returning", function() {
......
......@@ -117,6 +117,34 @@
controller.checkEmail();
});
asyncTest("clear password if user changes email address", function() {
xhr.useResult("known_secondary");
$("#email").val("registered@testuser.com");
var enterPasswordCount = 0;
mediator.subscribe("enter_password", function() {
// The first time the password is shown, change the email address. The
// second time the password is shown, make sure the password was cleared.
if(enterPasswordCount == 0) {
// simulate the user changing the email address. This should clear the
// password.
$("#password").val("password");
$("#email").val("testuser@testuser.com");
$("#email").keyup();
controller.checkEmail();
}
else {
equal($("#password").val(), "", "password field was cleared");
start();
}
enterPasswordCount++;
});
controller.checkEmail();
});
asyncTest("checkEmail with email that has IdP support - 'primary_user' message", function() {
$("#email").val("unregistered@testuser.com");
xhr.useResult("primary");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment