Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Commit

Permalink
merge fix for issue #1440 into train-2012.04.11 - fixes reset passwor…
Browse files Browse the repository at this point in the history
…d flow
  • Loading branch information
lloyd committed Apr 17, 2012
2 parents 7f071b6 + 7578971 commit db83245
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
5 changes: 4 additions & 1 deletion resources/static/dialog/controllers/check_registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ BrowserID.Modules.CheckRegistration = (function() {
});
}
else if (status === "mustAuth") {
self.close("authenticate", { email: self.email });
user.addressInfo(self.email, function(info) {
self.close("authenticate", info);
});

oncomplete && oncomplete();
}
}, self.getErrorDialog(errors.registration, oncomplete));
Expand Down
2 changes: 2 additions & 0 deletions resources/static/dialog/resources/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ BrowserID.State = (function() {
handleState("reset_password", function(msg, info) {
// reset password says the password has been reset, now waiting for
// confirmation.
info = info || {};
self.stagedEmail = info.email;
startAction(false, "doResetPassword", info);
});

Expand Down
8 changes: 8 additions & 0 deletions resources/static/test/cases/controllers/check_registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@

asyncTest("user validation with mustAuth result", function() {
xhr.useResult("mustAuth");
createController("waitForUserValidation");
register("authenticate", function(msg, info) {
equal(info.email, "registered@testuser.com", "correct email");
ok(info.type, "type sent with info");
ok(info.known, "email is known");
start();
});
controller.startCheck();

testVerifiedUserEvent("authenticate", "User Must Auth");
});
Expand Down
8 changes: 8 additions & 0 deletions resources/static/test/cases/resources/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@
equal(actions.info.doAuthenticate.email, TEST_EMAIL, "authenticate called with the correct email");
});

test("reset_password through to validation on same browser - call doEmailConfirmed with email address", function() {
mediator.publish("reset_password", { email: TEST_EMAIL });
mediator.publish("user_confirmed");

equal(actions.info.doEmailConfirmed.email, TEST_EMAIL, "doEmailConfirmed called with correct email");
});


asyncTest("assertion_generated with null assertion - redirect to pick_email", function() {
mediator.subscribe("pick_email", function() {
ok(true, "redirect to pick_email");
Expand Down
1 change: 1 addition & 0 deletions resources/static/test/mocks/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ BrowserID.Mocks.xhr = (function() {
"get /wsapi/address_info?email=unregistered%40testuser.com primary": { type: "primary", auth: "https://auth_url", prov: "https://prov_url" },
"get /wsapi/address_info?email=testuser%40testuser.com unknown_secondary": { type: "secondary", known: false },
"get /wsapi/address_info?email=testuser%40testuser.com known_secondary": { type: "secondary", known: true },
"get /wsapi/address_info?email=registered%40testuser.com mustAuth": { type: "secondary", known: true },
"get /wsapi/address_info?email=testuser%40testuser.com primary": { type: "primary", auth: "https://auth_url", prov: "https://prov_url" },
"get /wsapi/address_info?email=testuser%40testuser.com ajaxError": undefined,
"post /wsapi/add_email_with_assertion invalid": { success: false },
Expand Down

0 comments on commit db83245

Please sign in to comment.