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

Commit

Permalink
Fixing the complete registration flow when the browser the user compl…
Browse files Browse the repository at this point in the history
…etes registration is different from the one they started at.

* in check_registration.js, the "auth" message has been changed to "authenticate"
* in user.js, when the registration poll completes, set the "known" field of the address in the addressInfo cache to "true"

closes #1026, closes #973
  • Loading branch information
Shane Tomlinson authored and lloyd committed Feb 1, 2012
1 parent 09bc5d9 commit a63e9c4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/static/dialog/controllers/check_registration.js
Expand Up @@ -38,7 +38,7 @@ BrowserID.Modules.CheckRegistration = (function() {
});
}
else if (status === "mustAuth") {
self.close("auth", { email: self.email });
self.close("authenticate", { email: self.email });
oncomplete && oncomplete();
}
}, self.getErrorDialog(errors.registration, oncomplete));
Expand Down
13 changes: 13 additions & 0 deletions resources/static/shared/user.js
Expand Up @@ -112,6 +112,19 @@ BrowserID.User = (function() {
// ensure that the stagedOnBehalfOf is cleared so there is no stale
// data.
storage.setStagedOnBehalfOf("");

// To avoid too many address_info requests, returns from each
// address_info request are cached. If the user is doing
// a registrationPoll, it means the user was registering the address
// and the registration has completed. Because the status is
// "complete" or "known", we know that the address is known, so we
// toggle the field to be up to date. If the known field remains
// false, then the user is redirected back to the authentication
// page and the system thinks the address must be verified again.
if(addressCache[email]) {
addressCache[email].known = true;
}

if (onSuccess) {
onSuccess(status);
}
Expand Down
Expand Up @@ -50,7 +50,7 @@
asyncTest("user validation with mustAuth result", function() {
xhr.useResult("mustAuth");

testVerifiedUserEvent("auth", "User Must Auth");
testVerifiedUserEvent("authenticate", "User Must Auth");
});

asyncTest("user validation with pending->complete result ~3 seconds", function() {
Expand Down

0 comments on commit a63e9c4

Please sign in to comment.