From a4f29644c4a37c3530b8adcc0486dc34d7634c0f Mon Sep 17 00:00:00 2001 From: Birm Date: Tue, 12 Sep 2023 13:41:45 -0400 Subject: [PATCH] try auto token renew on landings --- apps/landing/crowd.html | 9 +++++++++ apps/landing/landing.html | 8 ++++++++ common/util.js | 7 +++++++ 3 files changed, 24 insertions(+) diff --git a/apps/landing/crowd.html b/apps/landing/crowd.html index 1f7224887..4570f5725 100644 --- a/apps/landing/crowd.html +++ b/apps/landing/crowd.html @@ -227,6 +227,15 @@

Whole Slide Imaging

if (userType== "Admin" || userType == "Expert"){ window.location = "./landing.html" } + + // renew token + fetch('../../auth/token/renew').then(x=>x.json()).then(x=>{ + if (x.hasOwnProperty("token")) { + console.log("renewing token", x.token) + functionTokenRenew(x.token) + } + + }).catch(e=>console.error); diff --git a/apps/landing/landing.html b/apps/landing/landing.html index 3bfbd33e5..9d37f654c 100644 --- a/apps/landing/landing.html +++ b/apps/landing/landing.html @@ -141,6 +141,14 @@

Whole Slide Imaging

if (userType !== "Admin"){ document.getElementById("userManage").style = "display:none;"; } + // renew token + fetch('../../auth/token/renew').then(x=>x.json()).then(x=>{ + if (x.hasOwnProperty("token")) { + console.log("renewing token", x.token) + functionTokenRenew(x.token) + } + + }).catch(e=>console.error); diff --git a/common/util.js b/common/util.js index 0a360aa6d..7b95fe028 100644 --- a/common/util.js +++ b/common/util.js @@ -860,6 +860,13 @@ function tokenSignOut(url) { } } +function TokenRenew(value){ + document.cookie = 'token='+value+';path=/camic_htt'; + document.cookie = 'token='+value+';path=/camic/htt'; + document.cookie = 'token='+value+';path=//camic_htt'; + document.cookie = 'token='+value+';path=//camic/htt'; +} + // alias in case I missed any function googleSignOut(url){ console.log("calling google signout, now alias to token signout");