From 6f54801f171088c9374ec5f7a539d8cde8765dfa Mon Sep 17 00:00:00 2001
From: Lloyd Hilaiel <lloyd@hilaiel.com>
Date: Tue, 27 Dec 2011 11:13:46 -0800
Subject: [PATCH] fix issue where when allowPersistent is true, and the user is
 not authenticated to browserid, they wouldn't be shown the 'keep me signed
 in' checkbox - closes #776 (presumably a regression introduce in
 f9ab1ba9c2cab2aede58e20d613aee585e1167f5 ?)

---
 resources/static/dialog/controllers/actions.js     | 4 ++--
 resources/static/dialog/controllers/dialog.js      | 1 -
 resources/static/dialog/resources/state_machine.js | 5 ++++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/resources/static/dialog/controllers/actions.js b/resources/static/dialog/controllers/actions.js
index 9e253e9ae..74ada70ab 100644
--- a/resources/static/dialog/controllers/actions.js
+++ b/resources/static/dialog/controllers/actions.js
@@ -155,9 +155,9 @@ BrowserID.Modules.Actions = (function() {
       user.logoutUser(self.publish.bind(self, "logged_out"), self.getErrorDialog(errors.logoutUser));
     },
 
-    doSyncThenPickEmail: function() {
+    doSyncThenPickEmail: function(options) {
       var self = this;
-      user.syncEmails(self.doPickEmail.bind(self),
+      user.syncEmails(self.doPickEmail.bind(self, options),
         self.getErrorDialog(errors.syncEmails));
     },
 
diff --git a/resources/static/dialog/controllers/dialog.js b/resources/static/dialog/controllers/dialog.js
index 0cc46aab5..832bc78b9 100644
--- a/resources/static/dialog/controllers/dialog.js
+++ b/resources/static/dialog/controllers/dialog.js
@@ -87,7 +87,6 @@ BrowserID.Modules.Dialog = (function() {
     }      
 
     try {
-      //
       WinChan.onOpen(function(origin, args, cb) {
         self.get(origin, args.params, function(r) {
           cb(r);
diff --git a/resources/static/dialog/resources/state_machine.js b/resources/static/dialog/resources/state_machine.js
index beb9f72d2..45f7b344b 100644
--- a/resources/static/dialog/resources/state_machine.js
+++ b/resources/static/dialog/resources/state_machine.js
@@ -167,7 +167,10 @@
     });
 
     subscribe("authenticated", function(msg, info) {
-      gotoState("doSyncThenPickEmail");
+      gotoState("doSyncThenPickEmail", {
+        origin: self.hostname,
+        allow_persistent: self.allowPersistent
+      });
     });
 
     subscribe("forgot_password", function(msg, info) {
-- 
GitLab