diff --git a/web/src/app/auth/login/EmailPasswordForm.tsx b/web/src/app/auth/login/EmailPasswordForm.tsx index 5802f0d35fe..df474bdcaca 100644 --- a/web/src/app/auth/login/EmailPasswordForm.tsx +++ b/web/src/app/auth/login/EmailPasswordForm.tsx @@ -5,7 +5,6 @@ import { usePopup } from "@/components/admin/connectors/Popup"; import { basicLogin, basicSignup } from "@/lib/user"; import { Button } from "@/components/ui/button"; import { Form, Formik } from "formik"; -import { useRouter } from "next/navigation"; import * as Yup from "yup"; import { requestEmailVerification } from "../lib"; import { useState } from "react"; @@ -22,10 +21,8 @@ export function EmailPasswordForm({ referralSource?: string; nextUrl?: string | null; }) { - const router = useRouter(); const { popup, setPopup } = usePopup(); const [isWorking, setIsWorking] = useState(false); - return ( <> {isWorking && } @@ -69,9 +66,13 @@ export function EmailPasswordForm({ if (loginResponse.ok) { if (isSignup && shouldVerify) { await requestEmailVerification(values.email); - router.push("/auth/waiting-on-verification"); + // Use window.location.href to force a full page reload, + // ensuring app re-initializes with the new state (including + // server-side provider values) + window.location.href = "/auth/waiting-on-verification"; } else { - router.push(nextUrl ? encodeURI(nextUrl) : "/"); + // See above comment + window.location.href = nextUrl ? encodeURI(nextUrl) : "/"; } } else { setIsWorking(false);