🔒 Use sanitizeUrl on redirectPath auth param (#1389)
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
"format:check": "prettier --check ./src"
|
||||
},
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "7.0.1",
|
||||
"@chakra-ui/anatomy": "2.1.1",
|
||||
"@chakra-ui/react": "2.7.1",
|
||||
"@chakra-ui/theme-tools": "2.0.18",
|
||||
|
@ -28,10 +28,12 @@ import { useToast } from '@/hooks/useToast'
|
||||
import { TextLink } from '@/components/TextLink'
|
||||
import { SignInError } from './SignInError'
|
||||
import { useTranslate } from '@tolgee/react'
|
||||
import { sanitizeUrl } from '@braintree/sanitize-url'
|
||||
|
||||
type Props = {
|
||||
defaultEmail?: string
|
||||
}
|
||||
|
||||
export const SignInForm = ({
|
||||
defaultEmail,
|
||||
}: Props & HTMLChakraProps<'form'>) => {
|
||||
@ -55,7 +57,8 @@ export const SignInForm = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (status === 'authenticated') {
|
||||
router.replace(router.query.redirectPath?.toString() ?? '/typebots')
|
||||
const redirectPath = router.query.redirectPath?.toString()
|
||||
router.replace(redirectPath ? sanitizeUrl(redirectPath) : '/typebots')
|
||||
return
|
||||
}
|
||||
;(async () => {
|
||||
|
Reference in New Issue
Block a user