From 83150629a6eb7c1c2dc3ec2b94a0e00d1c374297 Mon Sep 17 00:00:00 2001
From: Lloyd Hilaiel <lloyd@hilaiel.com>
Date: Fri, 16 Mar 2012 21:26:02 -0600
Subject: [PATCH] fix bug where when authentication state is changed in-dialog
 the comm iframe wouldn't notice, and would conclude the user is not
 authenticated based on a cached session_context response

---
 resources/static/communication_iframe/start.js | 3 +++
 resources/static/shared/network.js             | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/resources/static/communication_iframe/start.js b/resources/static/communication_iframe/start.js
index 2c87525c6..842dc6acd 100644
--- a/resources/static/communication_iframe/start.js
+++ b/resources/static/communication_iframe/start.js
@@ -90,6 +90,9 @@
 
   chan.bind("dialog_complete", function(trans, params) {
     pause = false;
+    // the dialog running can change authentication status,
+    // lets manually purge our network cache
+    network.clearContext();
     checkAndEmit();
   });
 }());
diff --git a/resources/static/shared/network.js b/resources/static/shared/network.js
index cbaf2c135..6a0852c98 100644
--- a/resources/static/shared/network.js
+++ b/resources/static/shared/network.js
@@ -154,6 +154,14 @@ BrowserID.Network = (function() {
       }, onFailure);
     },
 
+    /**
+     * clear local cache, including authentication status and
+     * other session data.
+     *
+     * @method clearContext
+     */
+    clearContext: clearContext,
+
     /**
      * Log the authenticated user out
      * @method logout
-- 
GitLab