Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
fix: remove mail from url
Browse files Browse the repository at this point in the history
  • Loading branch information
“konstantinosG-deriv” committed Nov 15, 2023
1 parent 24036c4 commit f7fc18a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/features/hooks/use-signup-form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ const useSignupForm = () => {
})
.then(() => {
const locale = getLanguage()
const success_default_link = `signup-success?email=${email}`
const success_default_link = `signup-success`
const link_with_language = `${locale}/${success_default_link}`
const success_link = `/${
locale === 'en' ? success_default_link : link_with_language
}`
Cookies.set('user_email', email)
navigate(success_link, { replace: true })
})
.catch((reason) => {
Expand Down
8 changes: 4 additions & 4 deletions src/pages/signup-success/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useState } from 'react'
import { navigate } from 'gatsby'
import { Analytics } from '@deriv/analytics'
import Cookies from 'js-cookie'
import { getLanguage, isBrowser } from 'common/utility'
import SignUpSuccessContainer from 'features/pages/signup-success'
import { WithIntl } from 'components/localization'
Expand All @@ -14,12 +15,11 @@ const SignupSuccess = () => {
form_name: 'default_diel_deriv',
}
useEffect(() => {
const params = new URLSearchParams(location.search)
const email = params.get('email')
const userEmail = Cookies.get('user_email')
const locale = getLanguage()

setRegisteredEmail(email?.replaceAll(' ', '+'))
if (!email) {
setRegisteredEmail(userEmail?.replaceAll(' ', '+'))
if (!userEmail) {
if (locale !== 'en') navigate(`/${locale}/`, { replace: true })
else {
navigate('/', { replace: true })
Expand Down

0 comments on commit f7fc18a

Please sign in to comment.