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 d2e4cd07ca
commit 2ed4b948b8
6 changed files with 42 additions and 32 deletions

View File

@@ -105,7 +105,7 @@ export async function authWithAccessToken(
);
}
const validCode = await verifyPassword(tokenItem.tokenHash, accessToken);
const validCode = await verifyPassword(accessToken, tokenItem.tokenHash);
if (!validCode) {
return next(
@@ -132,7 +132,7 @@ export async function authWithAccessToken(
accessTokenId: tokenItem.accessTokenId,
sessionLength: tokenItem.sessionLength,
expiresAt: tokenItem.expiresAt,
doNotExtend: tokenItem.expiresAt ? false : true
doNotExtend: tokenItem.expiresAt ? true : false
});
const cookieName = `${config.server.resource_session_cookie_name}_${resource.resourceId}`;
const cookie = serializeResourceSessionCookie(cookieName, token);

View File

@@ -51,7 +51,9 @@ export async function createResource(
);
}
const { name, subdomain } = parsedBody.data;
let { name, subdomain } = parsedBody.data;
subdomain = subdomain.toLowerCase(); // always to lower case
// Validate request params
const parsedParams = createResourceParamsSchema.safeParse(req.params);