Skip to content

Commit

Permalink
fix: decode uri component redirectTo
Browse files Browse the repository at this point in the history
  • Loading branch information
Melisa Anabella Rossi committed Dec 22, 2023
1 parent 0e19445 commit 7077d25
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/Pages/CallbackPage/CallbackPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const CallbackPage = () => {
setIsLoading(false)
await getUserSignature()
if (redirectTo) {
window.location.href = redirectTo
window.location.href = decodeURIComponent(redirectTo)
} else {
// Navigate to user or to any other site
// TODO: Navigate to the landing page.
Expand Down
2 changes: 1 addition & 1 deletion src/components/Pages/LoginPage/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const LoginPage = () => {
setConnectionModalState(ConnectionModalState.WAITING_FOR_SIGNATURE)
await getSignature(connectionData.account?.toLowerCase() ?? '', connectionData.provider)
if (redirectTo) {
window.location.href = redirectTo
window.location.href = decodeURIComponent(redirectTo)
} else {
navigate('/user')
}
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/redirection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useLocation } from 'react-router-dom'
export const useAfterLoginRedirection = () => {
const location = useLocation()
const search = new URLSearchParams(location.search)
const redirectToSearchParam = search.get('redirectTo')
const redirectToSearchParam = decodeURIComponent(search.get('redirectTo') || '')

if (redirectToSearchParam === null) {
return undefined
Expand Down

0 comments on commit 7077d25

Please sign in to comment.