Clear session cookie before login

This commit is contained in:
2025-05-13 12:56:42 +02:00
parent 6a45a485e9
commit c5f6e54cd9

View File

@@ -83,6 +83,10 @@ const login = async (e?: SubmitEvent) => {
}
try {
// Delete any existing auth cookie to prevent it from interfering with
// the request
document.cookie = "pd_auth_key=; Max-Age=0;"
const resp = await check_response(await fetch(
get_endpoint() + "/user/login",
{method: "POST", body: fd},
@@ -95,6 +99,9 @@ const login = async (e?: SubmitEvent) => {
}
}
// Save the session cookie
document.cookie = "pd_auth_key="+resp.auth_key+"; Max-Age=31536000;"
dispatch("login", {key: resp.auth_key})
if (typeof login_redirect === "string" && login_redirect.startsWith("/")) {