fix(auth): eliminate competing deleteCookie on login verify and ensure proper session persistence
This commit is contained in:
parent
3c57dfbc78
commit
cf42a32800
@ -821,11 +821,9 @@ app.post("/api/login/verify", async (c) => {
|
||||
|
||||
const cookieDomain = getCookieDomain(rpID);
|
||||
|
||||
// Clear any existing host-scoped cookie to prevent domain duplication
|
||||
deleteCookie(c, "session_id", { path: "/" });
|
||||
|
||||
setCookie(c, "session_id", sessionId, {
|
||||
domain: cookieDomain,
|
||||
path: "/",
|
||||
httpOnly: true,
|
||||
secure: true,
|
||||
sameSite: "Lax",
|
||||
|
||||
@ -159,7 +159,7 @@ export const AuthenticatedLayout = ({
|
||||
</style>
|
||||
<script src="https://unpkg.com/@simplewebauthn/browser/dist/bundle/index.umd.min.js">
|
||||
</script>
|
||||
<script src="/public/auth-client.js?v=2"></script>
|
||||
<script src="/public/auth-client.js?v=3"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header class="header">
|
||||
|
||||
@ -95,7 +95,7 @@ export const LoginPage = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/public/auth-client.js?v=2"></script>
|
||||
<script src="/public/auth-client.js?v=3"></script>
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
|
||||
@ -119,7 +119,7 @@ export const RegisterPage = (
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/public/auth-client.js?v=2"></script>
|
||||
<script src="/public/auth-client.js?v=3"></script>
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
|
||||
@ -248,6 +248,10 @@ async function startWebAuthnLogin(username) {
|
||||
setStatus(verificationJSON.error || "Login verification failed", true);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
console.error("[WebAuthn Login]", err);
|
||||
setStatus(
|
||||
err.message || "An unexpected error occurred during authentication",
|
||||
true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user