Skip to content
Snippets Groups Projects
Commit 3ef9b733 authored by Shane Tomlinson's avatar Shane Tomlinson
Browse files

Performing key/cert sync and generation while the arrow animation is being done.

Hopefully this minimizes the amount of delay the user notices.
parent dc3a5fa1
No related branches found
No related tags found
No related merge requests found
......@@ -95,8 +95,8 @@ PageController.extend("Dialog", {}, {
self.doConfirmUser(info.email);
});
hub.subscribe("email_chosen", function(msg, info) {
self.doEmailSelected(info.email);
hub.subscribe("assertion_generated", function(msg, info) {
self.doAssertionGenerated(info.assertion);
});
hub.subscribe("email_staged", function(msg, info) {
......@@ -180,19 +180,18 @@ PageController.extend("Dialog", {}, {
},
doEmailConfirmed: function() {
this.doEmailSelected(this.confirmEmail);
var self=this;
// yay! now we need to produce an assertion.
BrowserID.Identities.getAssertion(this.confirmEmail, self.doAssertionGenerated.bind(self));
},
doEmailSelected: function(email) {
doAssertionGenerated: function(assertion) {
var self=this;
// yay! now we need to produce an assertion.
BrowserID.Identities.getAssertion(email, function(assertion) {
// Clear onerror before the call to onsuccess - the code to onsuccess
// calls window.close, which would trigger the onerror callback if we
// tried this afterwards.
self.onerror = null;
self.onsuccess(assertion);
});
// Clear onerror before the call to onsuccess - the code to onsuccess
// calls window.close, which would trigger the onerror callback if we
// tried this afterwards.
self.onerror = null;
self.onsuccess(assertion);
},
doNotMe: function() {
......
......@@ -78,14 +78,31 @@
}
function signIn() {
var self=this;
var self=this,
animationComplete = false,
assertion,
email = $("input[type=radio]:checked").val();
function onComplete() {
if(assertion && animationComplete) {
self.close("assertion_generated", {
assertion: assertion
});
}
}
// Kick of the assertion fetching/keypair generating while we are shoing
// the animation, hopefully this minimizes the delay the user notices.
identities.getAssertion(email, function(assert) {
assertion = assert;
onComplete();
});
$("#signIn").animate({"width" : "685px"}, "slow", function () {
// post animation
$("body").delay(500).animate({ "opacity" : "0.5"}, "fast", function () {
var email = $("input[type=radio]:checked").val();
self.close("email_chosen", {
email: email
});
animationComplete = true;
onComplete();
});
});
}
......
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