stop the auto-logout loop after redirecting to the logout

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
Julien Veyssier 2024-02-20 17:51:16 +01:00 committed by nextcloud-command
parent 98845b4fbd
commit 7f30fbf1db

View file

@ -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)
}
/**