From e610c12b2ad84b2af93ab3b484fbcda0d75154eb Mon Sep 17 00:00:00 2001 From: Charlie Humphreys Date: Wed, 30 Mar 2022 10:24:25 -0500 Subject: [PATCH] update logout logic --- client/homebrew/navbar/account.navitem.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/homebrew/navbar/account.navitem.jsx b/client/homebrew/navbar/account.navitem.jsx index ebff531b6..be92cea92 100644 --- a/client/homebrew/navbar/account.navitem.jsx +++ b/client/homebrew/navbar/account.navitem.jsx @@ -23,9 +23,17 @@ const Account = createClass({ // Reset divider position window.localStorage.removeItem('naturalcrit-pane-split'); // Clear login cookie - document.cookie = `nc_session=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;samesite=lax;${window.domain ? `domain=${window.domain}` : ''}`; + let domain = ''; + if(window.location?.hostname) { + let domainArray = window.location.hostname.split('.'); + if(domainArray.length > 2){ + domainArray = [''].concat(domainArray.slice(-2)); + } + domain = domainArray.join('.'); + } + document.cookie = `nc_session=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;samesite=lax;${domain ? `domain=${domain}` : ''}`; window.location = '/'; - }; + } }, render : function(){