diff --git a/browserid/static/dialog/controllers/page_controller.js b/browserid/static/dialog/controllers/page_controller.js index f3031469ae8640f8db89a5fa37e374d6c57a3bbb..ba80f9bbff4ee3569571b92843c422b76aa2c0e7 100644 --- a/browserid/static/dialog/controllers/page_controller.js +++ b/browserid/static/dialog/controllers/page_controller.js @@ -95,14 +95,14 @@ renderWait: function(body, body_vars) { this.renderTemplates("#wait", body, body_vars); - $("body").removeClass("error").removeClass("form").addClass("waiting"); - $("#wait").stop().css('opacity', 1).hide().fadeIn(ANIMATION_TIME); + $("body").removeClass("error").removeClass("form").addClass("waiting").css('opacity', 1); + $("#wait").stop().hide().fadeIn(ANIMATION_TIME); }, renderError: function(error_vars) { this.renderTemplates("#error", "wait.ejs", error_vars); - $("body").removeClass("waiting").removeClass("form").addClass("error"); - $("#error").stop().css('opacity', 1).hide().fadeIn(ANIMATION_TIME); + $("body").removeClass("waiting").removeClass("form").addClass("error").css('opacity', 1); + $("#error").stop().hide().fadeIn(ANIMATION_TIME); }, onSubmit: function(event) { diff --git a/browserid/static/dialog/controllers/pickemail_controller.js b/browserid/static/dialog/controllers/pickemail_controller.js index 5266c4efe4067165667476b91e58ecbc0eeeac4f..1b3679c132953e12afd296df960419aa5a3cb945 100644 --- a/browserid/static/dialog/controllers/pickemail_controller.js +++ b/browserid/static/dialog/controllers/pickemail_controller.js @@ -110,13 +110,13 @@ var self=this; user.getAssertion(email, function(assert) { assertion = assert || null; - tryClose.call(self); + startAnimation.call(self); }, self.getErrorDialog(errors.getAssertion)); } function startAnimation() { + var self=this; if(!animationComplete) { - var self=this; $("#signIn").animate({"width" : "685px"}, "slow", function () { // post animation body.delay(500).animate({ "opacity" : "0.5"}, "fast", function () { @@ -125,6 +125,9 @@ }); }); } + else { + tryClose.call(self); + } } @@ -135,9 +138,7 @@ var valid = checkEmail.call(self, email); if (valid) { -// self.doWait(bid.Wait.generateKey); getAssertion.call(self, email); - startAnimation.call(self); } } diff --git a/browserid/static/dialog/resources/network.js b/browserid/static/dialog/resources/network.js index daf5edb840f8499da6483b6fc1d811aef77f6000..fa4d0eeae38cba1286bf630c4356f5189cba92c1 100644 --- a/browserid/static/dialog/resources/network.js +++ b/browserid/static/dialog/resources/network.js @@ -37,7 +37,8 @@ BrowserID.Network = (function() { "use strict"; - var csrf_token, + var XHR_TIMEOUT = 10000, + csrf_token, xhr = $, server_time, auth_status, @@ -70,7 +71,8 @@ BrowserID.Network = (function() { // to debug. success: deferResponse(options.success), error: deferResponse(xhrError(options.error, options.errorMessage)), - dataType: "json" + dataType: "json", + timeout: XHR_TIMEOUT }); } @@ -91,6 +93,7 @@ BrowserID.Network = (function() { // to debug. success: deferResponse(options.success), error: deferResponse(xhrError(options.error, options.errorMessage)), + timeout: XHR_TIMEOUT }); }, options.error); } @@ -109,7 +112,8 @@ BrowserID.Network = (function() { auth_status = result.authenticated; cb(); }, - error: deferResponse(xhrError(onFailure)) + error: deferResponse(xhrError(onFailure)), + timeout: XHR_TIMEOUT }); } }