This commit is contained in:
parent
83bd59cfe2
commit
983f0aa9e2
|
@ -40,8 +40,6 @@ export default new Elysia({
|
||||||
if (context.request.method !== "GET") {
|
if (context.request.method !== "GET") {
|
||||||
const originHeader = context.request.headers.get("Origin");
|
const originHeader = context.request.headers.get("Origin");
|
||||||
// NOTE: You may need to use `X-Forwarded-Host` instead
|
// NOTE: You may need to use `X-Forwarded-Host` instead
|
||||||
console.log(context.request.headers)
|
|
||||||
console.log(originHeader);
|
|
||||||
if (
|
if (
|
||||||
!originHeader ||
|
!originHeader ||
|
||||||
!verifyRequestOrigin(originHeader, ["chat.sad.ovh", "localhost:5173"])
|
!verifyRequestOrigin(originHeader, ["chat.sad.ovh", "localhost:5173"])
|
||||||
|
@ -53,8 +51,6 @@ export default new Elysia({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("CSRF check passed")
|
|
||||||
|
|
||||||
// use headers instead of Cookie API to prevent type coercion
|
// use headers instead of Cookie API to prevent type coercion
|
||||||
const cookieHeader = context.request.headers.get("Cookie") ?? "";
|
const cookieHeader = context.request.headers.get("Cookie") ?? "";
|
||||||
const sessionId = lucia.readSessionCookie(cookieHeader);
|
const sessionId = lucia.readSessionCookie(cookieHeader);
|
||||||
|
@ -64,7 +60,6 @@ export default new Elysia({
|
||||||
session: null,
|
session: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
console.log("Cookie exists")
|
|
||||||
|
|
||||||
const { session, user } = await lucia.validateSession(sessionId);
|
const { session, user } = await lucia.validateSession(sessionId);
|
||||||
if (session && session.fresh) {
|
if (session && session.fresh) {
|
||||||
|
|
Loading…
Reference in a new issue