Skip to content

Commit

Permalink
try auto token renew on landings
Browse files Browse the repository at this point in the history
  • Loading branch information
birm committed Sep 12, 2023
1 parent e7d494c commit a4f2964
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apps/landing/crowd.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,15 @@ <h3>Whole Slide Imaging</h3>
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);
</script>


Expand Down
8 changes: 8 additions & 0 deletions apps/landing/landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ <h3>Whole Slide Imaging</h3>
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);

</script>
</body>
Expand Down
7 changes: 7 additions & 0 deletions common/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit a4f2964

Please sign in to comment.