Cleanup oauth tokens cache

pull/2621/head
Chocobozzz 2020-05-11 08:40:38 +02:00
parent 3cf198e4f4
commit 81c647ff19
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 8 additions and 0 deletions

View File

@ -105,6 +105,14 @@ async function onExternalUserAuthenticated (options: {
authName authName
}) })
// Cleanup
const now = new Date()
for (const [ key, value ] of authBypassTokens) {
if (value.expires.getTime() < now.getTime()) {
authBypassTokens.delete(key)
}
}
res.redirect(`/login?externalAuthToken=${bypassToken}&username=${user.username}`) res.redirect(`/login?externalAuthToken=${bypassToken}&username=${user.username}`)
} }