From f7fc18a4429322f392ceaf153d19799db4ef041e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CkonstantinosG-deriv=E2=80=9D?= <“konstantinos.gkagiannis@regentmarkets.com”> Date: Wed, 15 Nov 2023 13:59:40 +0100 Subject: [PATCH] fix: remove mail from url --- src/features/hooks/use-signup-form/index.tsx | 3 ++- src/pages/signup-success/index.tsx | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/features/hooks/use-signup-form/index.tsx b/src/features/hooks/use-signup-form/index.tsx index 2e93c208c01..9f1014c2493 100644 --- a/src/features/hooks/use-signup-form/index.tsx +++ b/src/features/hooks/use-signup-form/index.tsx @@ -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) => { diff --git a/src/pages/signup-success/index.tsx b/src/pages/signup-success/index.tsx index 872691beb34..835d45b43d1 100644 --- a/src/pages/signup-success/index.tsx +++ b/src/pages/signup-success/index.tsx @@ -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' @@ -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 })