Revert "cookie handling"

This reverts commit ac9791c8ef.
This commit is contained in:
Stefan Lazic committed 2026-09-05 09:32:12 +01:00
1 parent 3de53f0a67
commit bcf7fa58d3
2 files changed
+2 -9

No files matched your search

@@ -35,7 +35,6 @@ describe("Manager session cookie", () => {
expect.any(String),
expect.objectContaining({ secure: false, path: "/" }),
);
expect(cookieSet).toHaveBeenCalledWith("nextchair_manager_session", "", { path: "/manager", maxAge: 0 });
});
it("marks the cookie Secure for an HTTPS deployment", async () => {
+2 -8
View File
@@ -25,11 +25,7 @@ export function authenticateManager(email: string, password: string) {
export async function createManagerSession() {
const config = getManagerConfig();
const value = `${config.adminEmail.trim().toLowerCase()}.${Date.now()}`;
const store = await cookies();
// Remove sessions issued by older builds with Path=/manager. Browsers can
// retain both cookies, and the stale one may be selected first on /manager.
store.set(COOKIE_NAME, "", { path: "/manager", maxAge: 0 });
store.set(COOKIE_NAME, `${value}.${signature(value, config.authSecret)}`, {
(await cookies()).set(COOKIE_NAME, `${value}.${signature(value, config.authSecret)}`, {
httpOnly: true,
sameSite: "strict",
secure: isSecureDeployment(),
@@ -41,9 +37,7 @@ export async function createManagerSession() {
}
export async function clearManagerSession() {
const store = await cookies();
store.delete(COOKIE_NAME);
store.set(COOKIE_NAME, "", { path: "/manager", maxAge: 0 });
(await cookies()).delete(COOKIE_NAME);
}
export async function isManagerAuthenticated() {