Fixes callbackUrl issue in login page (#1848)
* fix: remove use of window.location in redirect of callbackUrl in Login Page * Adds WEBSITE_URL constant to callbackUrl in login page Co-authored-by: Peer Richelsen <peeroke@gmail.com>pull/1850/head
parent
5f4bd87f0d
commit
5445ca5944
|
@ -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 = (
|
||||
<span>
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue