diff --git a/apps/web/pages/auth/login.tsx b/apps/web/pages/auth/login.tsx index 89284fcf..50b86120 100644 --- a/apps/web/pages/auth/login.tsx +++ b/apps/web/pages/auth/login.tsx @@ -58,7 +58,8 @@ export default function Login({ const telemetry = useTelemetry(); - const callbackUrl = typeof router.query?.callbackUrl === "string" ? router.query.callbackUrl : "/"; + const callbackUrl = + typeof router.query?.callbackUrl === "string" ? `${WEBSITE_URL}/${router.query.callbackUrl}` : "/"; const LoginFooter = ( @@ -98,7 +99,7 @@ export default function Login({ .then((res) => { if (!res) setErrorMessage(errorMessages[ErrorCode.InternalServerError]); // we're logged in! let's do a hard refresh to the desired url - else if (!res.error) window.location.replace(callbackUrl); + else if (!res.error) router.push(callbackUrl); // reveal two factor input if required else if (res.error === ErrorCode.SecondFactorRequired) setTwoFactorRequired(true); // fallback if error not found