diff --git a/resources/static/dialog/controllers/actions.js b/resources/static/dialog/controllers/actions.js index 4746c25b8fb6dce7ca20dfa635cb4f31798f2d9c..322749710534ba216c7ef8fd509c647e84260256 100644 --- a/resources/static/dialog/controllers/actions.js +++ b/resources/static/dialog/controllers/actions.js @@ -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) { diff --git a/resources/static/dialog/controllers/check_registration.js b/resources/static/dialog/controllers/check_registration.js index 3389f3f9e0ca7b47bb22e796e3c8135c91af9ce0..efd38e246b6c7ee4c19515f46c5720679949a6c9 100644 --- a/resources/static/dialog/controllers/check_registration.js +++ b/resources/static/dialog/controllers/check_registration.js @@ -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(); } diff --git a/resources/static/dialog/resources/helpers.js b/resources/static/dialog/resources/helpers.js index 5065a994c952b0f0c67dbca6a8ee4c73aab82a6a..e95f7388625b933ccd340778e6c4fcbcd416d709 100644 --- a/resources/static/dialog/resources/helpers.js +++ b/resources/static/dialog/resources/helpers.js @@ -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); }