Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop the auto-logout loop after redirecting to the logout page #43701

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
stop the auto-logout loop after redirecting to the logout
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
  • Loading branch information
julien-nc committed Feb 20, 2024
commit 5692c9a5ad7081f0b583ea584aa61771d64785b8
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