From dd9bc785a402785c62e5bd5f938f1c0ae485e961 Mon Sep 17 00:00:00 2001
From: Shane Tomlinson <stomlinson@mozilla.com>
Date: Tue, 11 Oct 2011 11:32:17 +0100
Subject: [PATCH] In getAssertion, not calling serverTime until we actually
 create the assertion.

---
 browserid/static/dialog/resources/user.js | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/browserid/static/dialog/resources/user.js b/browserid/static/dialog/resources/user.js
index 93169a250..53e4a69fc 100644
--- a/browserid/static/dialog/resources/user.js
+++ b/browserid/static/dialog/resources/user.js
@@ -529,17 +529,18 @@ BrowserID.User = (function() {
       // we use the current time from the browserid servers
       // to avoid issues with clock drift on user's machine.
       // (issue #329)
-      network.serverTime(function(serverTime) {
         var storedID = storage.getEmail(email),
             assertion;
 
         function createAssertion(idInfo) {
-          var sk = jwk.SecretKey.fromSimpleObject(idInfo.priv);
-          var tok = new jwt.JWT(null, serverTime, origin);
-          assertion = vep.bundleCertsAndAssertion([idInfo.cert], tok.sign(sk));
-          if (onSuccess) {
-            onSuccess(assertion);
-          }
+          network.serverTime(function(serverTime) {
+            var sk = jwk.SecretKey.fromSimpleObject(idInfo.priv);
+            var tok = new jwt.JWT(null, serverTime, origin);
+            assertion = vep.bundleCertsAndAssertion([idInfo.cert], tok.sign(sk));
+            if (onSuccess) {
+              onSuccess(assertion);
+            }
+          });
         }
 
         if (storedID) {
@@ -559,7 +560,6 @@ BrowserID.User = (function() {
         else if (onSuccess) {
           onSuccess();
         }
-      });
     },
 
     /**
-- 
GitLab