From 5d5513ce5da25d12dd54becc24e47be8d871170d Mon Sep 17 00:00:00 2001 From: Shane Tomlinson <stomlinson@mozilla.com> Date: Tue, 11 Oct 2011 12:54:01 +0100 Subject: [PATCH] In dialog_controller, if the passed assertion is null, email was not recognized or deleted, re-show the pick email. issue #401 --- .../static/dialog/controllers/dialog_controller.js | 13 +++++++++---- .../dialog/controllers/pickemail_controller.js | 6 ++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/browserid/static/dialog/controllers/dialog_controller.js b/browserid/static/dialog/controllers/dialog_controller.js index 1d8224aec..924f77cbb 100644 --- a/browserid/static/dialog/controllers/dialog_controller.js +++ b/browserid/static/dialog/controllers/dialog_controller.js @@ -97,7 +97,12 @@ }); hub.subscribe("assertion_generated", function(msg, info) { - self.doAssertionGenerated(info.assertion); + if(info.assertion !== null) { + self.doAssertionGenerated(info.assertion); + } + else { + self.doPickEmail(); + } }); hub.subscribe("email_staged", function(msg, info) { @@ -147,7 +152,7 @@ } }, - doSignIn: function() { + doPickEmail: function() { this.element.pickemail(); }, @@ -192,7 +197,7 @@ syncEmails: function() { var self = this; - user.syncEmails(self.doSignIn.bind(self), + user.syncEmails(self.doPickEmail.bind(self), self.getErrorDialog(BrowserID.Errors.signIn)); }, @@ -202,7 +207,7 @@ user.checkAuthenticationAndSync(function onSuccess() {}, function onComplete(authenticated) { if (authenticated) { - self.doSignIn(); + self.doPickEmail(); } else { self.doAuthenticate(); } diff --git a/browserid/static/dialog/controllers/pickemail_controller.js b/browserid/static/dialog/controllers/pickemail_controller.js index 49e6a018c..7f9a06f3b 100644 --- a/browserid/static/dialog/controllers/pickemail_controller.js +++ b/browserid/static/dialog/controllers/pickemail_controller.js @@ -91,7 +91,7 @@ cancelEvent(event); function onComplete() { - if(assertion && animationComplete) { + if(typeof assertion !== "undefined" && animationComplete) { self.close("assertion_generated", { assertion: assertion }); @@ -101,7 +101,7 @@ // Kick of the assertion fetching/keypair generating while we are showing // the animation, hopefully this minimizes the delay the user notices. user.getAssertion(email, function(assert) { - assertion = assert; + assertion = assert || null; onComplete(); }); @@ -160,6 +160,8 @@ } }); + $("body").css("opacity", "1"); + pickEmailState.call(this); }, -- GitLab