mirror of
https://github.com/makeplane/plane.git
synced 2025-12-16 11:57:56 +01:00
chore: update next path redirections with validation
This commit is contained in:
@@ -40,8 +40,7 @@ export const AuthRoot: FC = observer(() => {
|
|||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const emailParam = searchParams.get("email") || undefined;
|
const emailParam = searchParams.get("email") || undefined;
|
||||||
const error_code = searchParams.get("error_code") || undefined;
|
const error_code = searchParams.get("error_code") || undefined;
|
||||||
const nextPath = searchParams.get("next_path") || undefined;
|
const next_path = searchParams.get("next_path") || undefined;
|
||||||
const next_path = searchParams.get("next_path");
|
|
||||||
// states
|
// states
|
||||||
const [authMode, setAuthMode] = useState<EAuthModes>(EAuthModes.SIGN_UP);
|
const [authMode, setAuthMode] = useState<EAuthModes>(EAuthModes.SIGN_UP);
|
||||||
const [authStep, setAuthStep] = useState<EAuthSteps>(EAuthSteps.EMAIL);
|
const [authStep, setAuthStep] = useState<EAuthSteps>(EAuthSteps.EMAIL);
|
||||||
@@ -220,7 +219,7 @@ export const AuthRoot: FC = observer(() => {
|
|||||||
<AuthUniqueCodeForm
|
<AuthUniqueCodeForm
|
||||||
mode={authMode}
|
mode={authMode}
|
||||||
email={email}
|
email={email}
|
||||||
nextPath={nextPath}
|
nextPath={next_path}
|
||||||
handleEmailClear={() => {
|
handleEmailClear={() => {
|
||||||
setEmail("");
|
setEmail("");
|
||||||
setAuthStep(EAuthSteps.EMAIL);
|
setAuthStep(EAuthSteps.EMAIL);
|
||||||
@@ -234,7 +233,7 @@ export const AuthRoot: FC = observer(() => {
|
|||||||
isPasswordAutoset={isPasswordAutoset}
|
isPasswordAutoset={isPasswordAutoset}
|
||||||
isSMTPConfigured={isSMTPConfigured}
|
isSMTPConfigured={isSMTPConfigured}
|
||||||
email={email}
|
email={email}
|
||||||
nextPath={nextPath}
|
nextPath={next_path}
|
||||||
handleEmailClear={() => {
|
handleEmailClear={() => {
|
||||||
setEmail("");
|
setEmail("");
|
||||||
setAuthStep(EAuthSteps.EMAIL);
|
setAuthStep(EAuthSteps.EMAIL);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import type { FC, ReactNode } from "react";
|
|||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { useSearchParams, usePathname } from "next/navigation";
|
import { useSearchParams, usePathname } from "next/navigation";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
import { isValidNextPath } from "@plane/utils";
|
||||||
// components
|
// components
|
||||||
import { LogoSpinner } from "@/components/common/logo-spinner";
|
import { LogoSpinner } from "@/components/common/logo-spinner";
|
||||||
// helpers
|
// helpers
|
||||||
@@ -55,7 +56,7 @@ export const AuthenticationWrapper: FC<TAuthenticationWrapper> = observer((props
|
|||||||
let redirectionRoute = "/create-workspace";
|
let redirectionRoute = "/create-workspace";
|
||||||
|
|
||||||
// validating the nextPath from the router query
|
// validating the nextPath from the router query
|
||||||
if (nextPath && isValidURL(nextPath.toString())) {
|
if (nextPath && isValidURL(nextPath.toString()) && isValidNextPath(sanitize(nextPath.toString()))) {
|
||||||
redirectionRoute = nextPath.toString();
|
redirectionRoute = nextPath.toString();
|
||||||
return redirectionRoute;
|
return redirectionRoute;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
"unrs-resolver"
|
"unrs-resolver"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.12.1",
|
"packageManager": "pnpm@10.20.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=22.18.0"
|
"node": ">=22.18.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user