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

don't require that a user re-enter their password in dialog after email...

don't require that a user re-enter their password in dialog after email verification in a different browser.  Because the user just typed their password, attempt to authenticate them in the verification originating browser via the API.  If that works, then automatically log them in
parent 7df7b9c9
No related branches found
No related tags found
No related merge requests found
......@@ -31,12 +31,13 @@ BrowserID.Modules.Actions = (function() {
return module;
}
function startRegCheckService(options, verifier, message) {
function startRegCheckService(options, verifier, message, password) {
var controller = startService("check_registration", {
email: options.email,
required: options.required,
verifier: verifier,
verificationMessage: message
verificationMessage: message,
password: password
});
controller.startCheck();
}
......@@ -82,7 +83,7 @@ BrowserID.Modules.Actions = (function() {
},
doConfirmUser: function(info) {
startRegCheckService.call(this, info, "waitForUserValidation", "user_confirmed");
startRegCheckService.call(this, info, "waitForUserValidation", "user_confirmed", info.password || undefined);
},
doPickEmail: function(info) {
......
......@@ -23,6 +23,7 @@ BrowserID.Modules.CheckRegistration = (function() {
self.verifier = options.verifier;
self.verificationMessage = options.verificationMessage;
self.required = options.required;
self.password = options.password;
self.click("#back", self.back);
......@@ -40,9 +41,26 @@ BrowserID.Modules.CheckRegistration = (function() {
});
}
else if (status === "mustAuth") {
user.addressInfo(self.email, function(info) {
self.close("authenticate", info);
});
// if we have a password (because it was just chosen in dialog),
// then we can authenticate the user and proceed
if (self.password) {
user.authenticate(self.email, self.password, function (authenticated) {
if (authenticated) {
user.syncEmails(function() {
self.close(self.verificationMessage);
oncomplete && oncomplete();
});
} else {
user.addressInfo(self.email, function(info) {
self.close("authenticate", info);
});
}
});
} else {
user.addressInfo(self.email, function(info) {
self.close("authenticate", info);
});
}
oncomplete && oncomplete();
}
......
......@@ -62,7 +62,7 @@
var self=this;
user.createSecondaryUser(email, password, function(status) {
if (status) {
var info = { email: email };
var info = { email: email, password: password };
self.publish("user_staged", info, info);
complete(callback, true);
}
......
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