diff --git a/browserid/static/dialog/controllers/authenticate_controller.js b/browserid/static/dialog/controllers/authenticate_controller.js index aceadf2b606fccd51a17f0735c6f21be2f518a4c..3ad5d5e8b7f21a77833ca98ca2729b3ffe96e24d 100644 --- a/browserid/static/dialog/controllers/authenticate_controller.js +++ b/browserid/static/dialog/controllers/authenticate_controller.js @@ -40,7 +40,8 @@ var ANIMATION_TIME = 250, identities = BrowserID.Identities; - function checkEmail() { + function checkEmail(el, event) { + cancelEvent(event); var email = $("#email").val(), self = this; @@ -61,10 +62,12 @@ }); } - function createUser() { + function createUser(el, event) { var self=this, email = $("#email").val(); + cancelEvent(event); + if(!email) { // XXX error screen return; @@ -83,11 +86,13 @@ }, self.getErrorDialog(BrowserID.Errors.createAccount)); } - function authenticate() { + function authenticate(el, event) { var email = $("#email").val(), pass = $("#password").val(), self = this; + cancelEvent(event); + if(!(email && pass)) { // XXX error screen return; @@ -116,9 +121,12 @@ } - function resetPassword() { - var email = $("#email").val(); - var self=this; + function resetPassword(el, event) { + var email = $("#email").val(), + self=this; + + cancelEvent(event); + identities.requestPasswordReset(email, function() { self.close("reset_password", { email: email diff --git a/browserid/static/dialog/controllers/dialog_controller.js b/browserid/static/dialog/controllers/dialog_controller.js index a9af2c15b0f246b3a124220249318be51d949d75..dc1b0923681c4f35a9fc769bcc014d2863c1eedd 100644 --- a/browserid/static/dialog/controllers/dialog_controller.js +++ b/browserid/static/dialog/controllers/dialog_controller.js @@ -61,7 +61,7 @@ PageController.extend("Dialog", {}, { BrowserID.Identities.setOrigin(origin_url); - this.doStart(); + this.doCheckAuth(); var self=this; $(window).bind("unload", function() { @@ -112,7 +112,7 @@ PageController.extend("Dialog", {}, { }); hub.subscribe("start", function() { - self.doStart(); + self.doCheckAuth(); }); hub.subscribe("cancel", function() { @@ -131,15 +131,6 @@ PageController.extend("Dialog", {}, { }); }, - doStart: function() { - // we should always check to see whether we're authenticated - // at dialog start. issue #74. - // - // (lth) XXX: we could include both csrf token and auth status - // in the intial resource serving to reduce network requests. - this.doCheckAuth(); - }, - doCancel: function() { var self=this; if(self.onsuccess) { @@ -155,10 +146,6 @@ PageController.extend("Dialog", {}, { this.element.authenticate(); }, - doCreate: function() { - //this.element.createaccount(); - }, - doForgotPassword: function(email) { this.element.forgotpassword({ email: email diff --git a/browserid/static/dialog/controllers/page_controller.js b/browserid/static/dialog/controllers/page_controller.js index 8988c59cac3417632538e722365f9eb7578b5992..72b1198c8a0c01d7336137605fefb55c50e3c36b 100644 --- a/browserid/static/dialog/controllers/page_controller.js +++ b/browserid/static/dialog/controllers/page_controller.js @@ -95,7 +95,7 @@ }, submit: function() { - this.close("submit"); + // this.close("submit"); }, doWait: function(info) { diff --git a/browserid/static/dialog/controllers/pickemail_controller.js b/browserid/static/dialog/controllers/pickemail_controller.js index cfe145172de04fb587a46afed105ca4a76ef75f2..38cc32491a867b61d70872ea8bb897126b590f11 100644 --- a/browserid/static/dialog/controllers/pickemail_controller.js +++ b/browserid/static/dialog/controllers/pickemail_controller.js @@ -77,12 +77,14 @@ }); } - function signIn() { + function signIn(element, event) { var self=this, animationComplete = false, assertion, email = $("input[type=radio]:checked").val(); + cancelEvent(event); + function onComplete() { if(assertion && animationComplete) { self.close("assertion_generated", { @@ -107,10 +109,12 @@ }); } - function addEmail() { + function addEmail(element, event) { var email = $("#newEmail").val(), self=this; + cancelEvent(event); + if (email) { identities.addEmail(email, function(keypair) { if (keypair) { diff --git a/browserid/static/dialog/views/pickemail.ejs b/browserid/static/dialog/views/pickemail.ejs index 8514d727287180d3c04ad1d00e3af5643550ed7c..4754b1cbca2b01a2e5deb55062ec701207ff8fed 100644 --- a/browserid/static/dialog/views/pickemail.ejs +++ b/browserid/static/dialog/views/pickemail.ejs @@ -13,7 +13,7 @@ <div class="vertical"> <strong>Sign in using</strong> - <section id="selectEmail"> + <div id="selectEmail"> <ul class="inputs"> <% _.each(identities, function(email_obj, email_address) { %> <li> @@ -30,9 +30,9 @@ <a id="useNewEmail" href="#">Use a different email</a> <button id="signInButton">sign in</button> </div> - </section> + </div> - <section id="addEmail" class="cf"> + <div id="addEmail" class="cf"> <div class="inputs"> <label for="newEmail">New email address</label> @@ -44,7 +44,7 @@ <button id="cancelNewEmail">cancel</button> </div> - </section> + </div> </div> </div>