1- import { Box , Button } from "@zenml-io/react-component-library " ;
1+ import ArrowRight from "@/assets/icons/arrow-right.svg?react " ;
22import CheckCircle from "@/assets/icons/check-circle.svg?react" ;
3- import { Link , useSearchParams } from "react-router-dom " ;
3+ import { urlSchema } from "@/lib/url " ;
44import { routes } from "@/router/routes" ;
5+ import { Box , Button } from "@zenml-io/react-component-library" ;
56import { ReactNode } from "react" ;
6- import ArrowRight from "@/assets/icons/arrow-right.svg? react" ;
7+ import { Link , useSearchParams } from "react-router-dom " ;
78
89type Props = {
910 username : string ;
@@ -15,6 +16,8 @@ export function SuccessStep({ username, subHeader, displayBody = true }: Props)
1516 const [ params ] = useSearchParams ( ) ;
1617
1718 const redirect = params . get ( "redirect" ) ;
19+ const sanitizedRedirect = redirect && `${ window . location . origin } ${ redirect } ` ;
20+ const isUrl = urlSchema . safeParse ( sanitizedRedirect ) ;
1821
1922 return (
2023 < Box className = "flex max-w-[540px] flex-col items-center justify-center space-y-7 px-7 py-9" >
@@ -34,7 +37,7 @@ export function SuccessStep({ username, subHeader, displayBody = true }: Props)
3437 </ p >
3538 ) }
3639 < Button className = "inline-flex" size = "md" intent = "primary" asChild >
37- < Link to = { redirect || routes . home } >
40+ < Link to = { isUrl . success ? isUrl . data : routes . home } >
3841 < span > Go to Dashboard</ span >
3942 < ArrowRight className = "h-5 w-5 fill-white" />
4043 </ Link >
0 commit comments