]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/auth.ts
Fix tests
[github/Chocobozzz/PeerTube.git] / server / lib / auth.ts
index 7c1dd1139b4ba9cb00a553f678d345ed7ecce485..8579bdbb44401e0f6fe0b1d4d5e82b54284a0ff8 100644 (file)
@@ -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}`)
 }