diff --git a/platform/src/pages/account/creation/individual/register.jsx b/platform/src/pages/account/creation/individual/register.jsx index 822e0babcd..c04a5fc458 100644 --- a/platform/src/pages/account/creation/individual/register.jsx +++ b/platform/src/pages/account/creation/individual/register.jsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import AccountPageLayout from '@/components/Account/Layout'; import Link from 'next/link'; import { useDispatch } from 'react-redux'; @@ -28,12 +28,22 @@ const IndividualAccountRegistration = () => { const dispatch = useDispatch(); const router = useRouter(); + const { userExists, userEmail } = router.query; const [loading, setLoading] = useState(false); const [creationErrors, setCreationErrors] = useState({ state: false, message: '', }); + useEffect(() => { + if (userEmail) { + setEmail(userEmail); + } + if (userExists === 'true') { + router.push('/account/login'); + } + }, [userExists, userEmail]); + const handleSubmit = async (e) => { e.preventDefault(); setLoading(true); @@ -148,6 +158,7 @@ const IndividualAccountRegistration = () => {
Email address*
setEmail(e.target.value)} type='email' placeholder='Enter your email'