fix access token session do not extend and make domains lower case

This commit is contained in:
Milo Schwartz 2024-12-26 15:13:49 -05:00
parent 9992abf65c
commit 35b67cd3cc
6 changed files with 42 additions and 32 deletions

View file

@ -88,19 +88,20 @@ export async function validateResourceSessionToken(
.where(eq(resourceSessions.sessionId, resourceSessions.sessionId));
return { resourceSession: null };
} else if (
!resourceSession.doNotExtend &&
Date.now() >=
resourceSession.expiresAt - resourceSession.sessionLength / 2
) {
resourceSession.expiresAt = new Date(
Date.now() + resourceSession.sessionLength
).getTime();
await db
if (!resourceSession.doNotExtend) {
resourceSession.expiresAt = new Date(
Date.now() + resourceSession.sessionLength
).getTime();
await db
.update(resourceSessions)
.set({
expiresAt: resourceSession.expiresAt
})
.where(eq(resourceSessions.sessionId, resourceSession.sessionId));
}
}
return { resourceSession };