From: Chocobozzz Date: Mon, 11 May 2020 06:40:38 +0000 (+0200) Subject: Cleanup oauth tokens cache X-Git-Tag: v2.2.0-rc.1~57 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=81c647ff191677e3b77814545d12e590c7ebfb1d;p=oweals%2Fpeertube.git Cleanup oauth tokens cache --- diff --git a/server/lib/auth.ts b/server/lib/auth.ts index 7c1dd1139..8579bdbb4 100644 --- a/server/lib/auth.ts +++ b/server/lib/auth.ts @@ -105,6 +105,14 @@ async function onExternalUserAuthenticated (options: { 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}`) }