mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-26 14:56:39 +00:00
Merge pull request #2535 from Abhinav-kodes/fix-resource-session-delete-cookie
fix: correct session DELETE tautology and HTTP cookie domain interpolation
This commit is contained in:
@@ -87,7 +87,7 @@ export async function validateResourceSessionToken(
|
|||||||
if (Date.now() >= resourceSession.expiresAt) {
|
if (Date.now() >= resourceSession.expiresAt) {
|
||||||
await db
|
await db
|
||||||
.delete(resourceSessions)
|
.delete(resourceSessions)
|
||||||
.where(eq(resourceSessions.sessionId, resourceSessions.sessionId));
|
.where(eq(resourceSessions.sessionId, sessionId));
|
||||||
return { resourceSession: null };
|
return { resourceSession: null };
|
||||||
} else if (
|
} else if (
|
||||||
Date.now() >=
|
Date.now() >=
|
||||||
@@ -181,7 +181,7 @@ export function serializeResourceSessionCookie(
|
|||||||
return `${cookieName}_s.${now}=${token}; HttpOnly; SameSite=Lax; Expires=${expiresAt.toUTCString()}; Path=/; Secure; Domain=${domain}`;
|
return `${cookieName}_s.${now}=${token}; HttpOnly; SameSite=Lax; Expires=${expiresAt.toUTCString()}; Path=/; Secure; Domain=${domain}`;
|
||||||
} else {
|
} else {
|
||||||
if (expiresAt === undefined) {
|
if (expiresAt === undefined) {
|
||||||
return `${cookieName}.${now}=${token}; HttpOnly; SameSite=Lax; Path=/; Domain=$domain}`;
|
return `${cookieName}.${now}=${token}; HttpOnly; SameSite=Lax; Path=/; Domain=${domain}`;
|
||||||
}
|
}
|
||||||
return `${cookieName}.${now}=${token}; HttpOnly; SameSite=Lax; Expires=${expiresAt.toUTCString()}; Path=/; Domain=${domain}`;
|
return `${cookieName}.${now}=${token}; HttpOnly; SameSite=Lax; Expires=${expiresAt.toUTCString()}; Path=/; Domain=${domain}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user