Skip to content

Commit

Permalink
stop the auto-logout loop after redirecting to the logout
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
  • Loading branch information
julien-nc committed Feb 21, 2024
1 parent 1442477 commit b3fc30a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/session-heartbeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,17 @@ const registerAutoLogout = () => {
lastActive = e.newValue
})

setInterval(function() {
let intervalId = 0
const logoutCheck = () => {
const timeout = Date.now() - config.session_lifetime * 1000
if (lastActive < timeout) {
clearTimeout(intervalId)
console.info('Inactivity timout reached, logging out')
const logoutUrl = generateUrl('/logout') + '?requesttoken=' + encodeURIComponent(getRequestToken())
window.location = logoutUrl
}
}, 1000)
}
intervalId = setInterval(logoutCheck, 1000)
}

/**
Expand Down

0 comments on commit b3fc30a

Please sign in to comment.