From fe95276ba849bc7a520087369eea0aaff6c92358 Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Thu, 4 May 2017 16:36:31 -0400
Subject: PLT-6492 Use new cookie to determine if user is logged in (#6317)

* Use new cookie to determine if user is logged in

* Add temporary code for 3.9 to prevent forced re-login
---
 webapp/root.jsx | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

(limited to 'webapp/root.jsx')

diff --git a/webapp/root.jsx b/webapp/root.jsx
index 03595f85c..94645b661 100644
--- a/webapp/root.jsx
+++ b/webapp/root.jsx
@@ -13,7 +13,6 @@ import PDFJS from 'pdfjs-dist';
 import * as Websockets from 'actions/websocket_actions.jsx';
 import {loadMeAndConfig} from 'actions/user_actions.jsx';
 import ChannelStore from 'stores/channel_store.jsx';
-import UserStore from 'stores/user_store.jsx';
 import * as I18n from 'i18n/i18n.jsx';
 
 // Import our styles
@@ -61,9 +60,7 @@ function preRenderSetup(callwhendone) {
 
     setUrl(window.location.origin);
 
-    const currentUserId = localStorage.getItem('currentUserId');
-
-    if (currentUserId) {
+    if (document.cookie.indexOf('MMUSERID=') > -1) {
         loadMeAndConfig(() => d1.resolve());
     } else {
         getClientConfig()(store.dispatch, store.getState).then(
@@ -85,7 +82,7 @@ function preRenderSetup(callwhendone) {
          () => {
              // Turn off to prevent getting stuck in a loop
              $(window).off('beforeunload');
-             if (UserStore.getCurrentUser()) {
+             if (document.cookie.indexOf('MMUSERID=') > -1) {
                  viewChannel('', ChannelStore.getCurrentId() || '')(dispatch, getState);
              }
              Websockets.close();
-- 
cgit v1.2.3-1-g7c22

