From 5dbefdecfe611f9496f9105a62e8f46ccb927add Mon Sep 17 00:00:00 2001
From: =Corey Hulen <corey@hulen.com>
Date: Thu, 5 Nov 2015 11:54:40 -0800
Subject: PLT-1016 force logout on other browsers

---
 web/react/stores/browser_store.jsx | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

(limited to 'web/react/stores/browser_store.jsx')

diff --git a/web/react/stores/browser_store.jsx b/web/react/stores/browser_store.jsx
index 75fb8aa3c..b88ca43cd 100644
--- a/web/react/stores/browser_store.jsx
+++ b/web/react/stores/browser_store.jsx
@@ -24,6 +24,8 @@ class BrowserStoreClass {
         this.setLastServerVersion = this.setLastServerVersion.bind(this);
         this.clear = this.clear.bind(this);
         this.clearAll = this.clearAll.bind(this);
+        this.checkedLocalStorageSupported = '';
+        this.signalLogout = this.signalLogout.bind(this);
 
         var currentVersion = sessionStorage.getItem('storage_version');
         if (currentVersion !== global.window.mm_config.Version) {
@@ -105,6 +107,13 @@ class BrowserStoreClass {
         sessionStorage.setItem('last_server_version', version);
     }
 
+    signalLogout() {
+        if (this.isLocalStorageSupported()) {
+            localStorage.setItem('__logout__', 'yes');
+            localStorage.removeItem('__logout__');
+        }
+    }
+
     /**
      * Preforms the given action on each item that has the given prefix
      * Signature for action is action(key, value)
@@ -147,20 +156,26 @@ class BrowserStoreClass {
     }
 
     isLocalStorageSupported() {
+        if (this.checkedLocalStorageSupported !== '') {
+            return this.checkedLocalStorageSupported;
+        }
+
         try {
-            sessionStorage.setItem('testSession', '1');
-            sessionStorage.removeItem('testSession');
+            sessionStorage.setItem('__testSession__', '1');
+            sessionStorage.removeItem('__testSession__');
 
-            localStorage.setItem('testLocal', '1');
-            if (localStorage.getItem('testLocal') !== '1') {
-                return false;
+            localStorage.setItem('__testLocal__', '1');
+            if (localStorage.getItem('__testLocal__') !== '1') {
+                this.checkedLocalStorageSupported = false;
             }
-            localStorage.removeItem('testLocal', '1');
+            localStorage.removeItem('__testLocal__', '1');
 
-            return true;
+            this.checkedLocalStorageSupported = true;
         } catch (e) {
-            return false;
+            this.checkedLocalStorageSupported = false;
         }
+
+        return this.checkedLocalStorageSupported;
     }
 }
 
-- 
cgit v1.2.3-1-g7c22


From 17cd95ae054b68a0f6816c6038f67a8901ac94d5 Mon Sep 17 00:00:00 2001
From: =Corey Hulen <corey@hulen.com>
Date: Thu, 5 Nov 2015 12:14:27 -0800
Subject: Fixing issue with safari private mode

---
 web/react/stores/browser_store.jsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'web/react/stores/browser_store.jsx')

diff --git a/web/react/stores/browser_store.jsx b/web/react/stores/browser_store.jsx
index b88ca43cd..8e86ce32f 100644
--- a/web/react/stores/browser_store.jsx
+++ b/web/react/stores/browser_store.jsx
@@ -30,7 +30,11 @@ class BrowserStoreClass {
         var currentVersion = sessionStorage.getItem('storage_version');
         if (currentVersion !== global.window.mm_config.Version) {
             sessionStorage.clear();
-            sessionStorage.setItem('storage_version', global.window.mm_config.Version);
+            try {
+                sessionStorage.setItem('storage_version', global.window.mm_config.Version);
+            } catch (e) {
+                // Do nothing
+            }
         }
     }
 
-- 
cgit v1.2.3-1-g7c22

