Clear session cookie before login
This commit is contained in:
@@ -83,6 +83,10 @@ const login = async (e?: SubmitEvent) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
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(
|
const resp = await check_response(await fetch(
|
||||||
get_endpoint() + "/user/login",
|
get_endpoint() + "/user/login",
|
||||||
{method: "POST", body: fd},
|
{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})
|
dispatch("login", {key: resp.auth_key})
|
||||||
|
|
||||||
if (typeof login_redirect === "string" && login_redirect.startsWith("/")) {
|
if (typeof login_redirect === "string" && login_redirect.startsWith("/")) {
|
||||||
|
Reference in New Issue
Block a user