@@ -108,8 +108,16 @@ export function NDAPage(props: {
|
||||
const continueUrlParam = searchParams.get("continue");
|
||||
let safeContinueUrl: string;
|
||||
if (continueUrlParam) {
|
||||
const continueUrl = new URL(continueUrlParam);
|
||||
safeContinueUrl = window.location.origin + continueUrl.pathname + continueUrl.search;
|
||||
try {
|
||||
const continueUrl = new URL(continueUrlParam, window.location.origin);
|
||||
if (continueUrl.origin === window.location.origin && continueUrl.pathname.startsWith(`${getPathPrefix()}/`)) {
|
||||
safeContinueUrl = window.location.origin + continueUrl.pathname + continueUrl.search;
|
||||
} else {
|
||||
safeContinueUrl = window.location.origin + getPathPrefix();
|
||||
}
|
||||
} catch {
|
||||
safeContinueUrl = window.location.origin + getPathPrefix();
|
||||
}
|
||||
} else {
|
||||
safeContinueUrl = window.location.origin + getPathPrefix();
|
||||
}
|
||||
|
||||
@@ -63,11 +63,18 @@ export function ConnectPage(props: {
|
||||
const continueUrlParam = searchParams.get("continue");
|
||||
let safeContinueUrl: string;
|
||||
if (continueUrlParam) {
|
||||
const continueUrl = new URL(continueUrlParam);
|
||||
safeContinueUrl = window.location.origin + continueUrl.pathname + continueUrl.search;
|
||||
try {
|
||||
const continueUrl = new URL(continueUrlParam, window.location.origin);
|
||||
if (continueUrl.origin === window.location.origin && continueUrl.pathname.startsWith(`${getPathPrefix()}/`)) {
|
||||
safeContinueUrl = window.location.origin + continueUrl.pathname + continueUrl.search;
|
||||
} else {
|
||||
safeContinueUrl = window.location.origin + (getPathPrefix() || "/");
|
||||
}
|
||||
} catch {
|
||||
safeContinueUrl = window.location.origin + (getPathPrefix() || "/");
|
||||
}
|
||||
} else {
|
||||
const pathPrefix = getPathPrefix();
|
||||
safeContinueUrl = window.location.origin + (pathPrefix ? getPathPrefix() : "/");
|
||||
safeContinueUrl = window.location.origin + (getPathPrefix() || "/");
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -119,8 +126,7 @@ export function ConnectPage(props: {
|
||||
if (errors) {
|
||||
for (const err of errors) {
|
||||
if (err.extensions?.code === "ALREADY_AUTHENTICATED") {
|
||||
const pathPrefix = getPathPrefix();
|
||||
window.location.href = pathPrefix ? getPathPrefix() : "/";
|
||||
window.location.href = getPathPrefix() || "/";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,8 +42,7 @@ export default function VerifyMagicLinkPagePageMutation() {
|
||||
if (errors) {
|
||||
for (const err of errors) {
|
||||
if (err.extensions?.code === "ALREADY_AUTHENTICATED") {
|
||||
const pathPrefix = getPathPrefix();
|
||||
window.location.href = pathPrefix ? getPathPrefix() : "/";
|
||||
window.location.href = getPathPrefix() || "/";
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -64,11 +63,14 @@ export default function VerifyMagicLinkPagePageMutation() {
|
||||
});
|
||||
|
||||
if (verifyMagicLink?.continue) {
|
||||
const continueUrl = new URL(verifyMagicLink.continue);
|
||||
window.location.href = window.location.origin + continueUrl.pathname + continueUrl.search;
|
||||
try {
|
||||
const continueUrl = new URL(verifyMagicLink.continue, window.location.origin);
|
||||
window.location.href = window.location.origin + continueUrl.pathname + continueUrl.search;
|
||||
} catch {
|
||||
window.location.href = getPathPrefix() || "/";
|
||||
}
|
||||
} else {
|
||||
const pathPrefix = getPathPrefix();
|
||||
window.location.href = pathPrefix ? getPathPrefix() : "/";
|
||||
window.location.href = getPathPrefix() || "/";
|
||||
}
|
||||
},
|
||||
onError: (err) => {
|
||||
|
||||
Reference in New Issue
Block a user