fix: logout properly expires cookie with matching domain/path attributes
This commit is contained in:
parent
8221b3a33d
commit
3df7f4b702
|
|
@ -80,7 +80,7 @@ export const account = new Elysia({ prefix: "/account" })
|
|||
}, { detail: { hide: true } })
|
||||
|
||||
.get("/logout", ({ cookie, set }) => {
|
||||
cookie.pingql_key.remove();
|
||||
cookie.pingql_key.set({ value: "", ...COOKIE_OPTS, maxAge: 0 });
|
||||
set.redirect = "/dashboard";
|
||||
}, { detail: { hide: true } })
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,8 @@ export const dashboard = new Elysia()
|
|||
|
||||
// Logout
|
||||
.get("/dashboard/logout", ({ cookie }) => {
|
||||
cookie.pingql_key?.remove();
|
||||
// Explicitly expire with same domain/path so browser actually clears it
|
||||
cookie.pingql_key?.set({ value: "", maxAge: 0, path: "/", domain: process.env.COOKIE_DOMAIN ?? ".pingql.com", secure: process.env.NODE_ENV !== "development", sameSite: "lax" });
|
||||
return redirect("/dashboard");
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue