ENCOA-279
This commit is contained in:
@@ -23,7 +23,7 @@ const EMAIL_REGEX = new RegExp(/^[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*@[a-zA-Z0-9]+(?:
|
||||
export const getServerSideProps = withIronSessionSsr(async ({ req, res, query }) => {
|
||||
const destination = !query.destination ? "/" : Buffer.from(query.destination as string, 'base64').toString()
|
||||
const user = await requestUser(req, res)
|
||||
if (user) return redirect(destination)
|
||||
if (user && user.isVerified) return redirect(destination)
|
||||
|
||||
return {
|
||||
props: { user: null, destination },
|
||||
@@ -39,13 +39,10 @@ export default function Login({ destination = "/" }: { destination?: string }) {
|
||||
const router = useRouter();
|
||||
const isOfficialExamLogin = useMemo(() => destination.startsWith("/official-exam"), [destination])
|
||||
|
||||
const { user, mutateUser } = useUser({
|
||||
redirectTo: destination,
|
||||
redirectIfFound: true,
|
||||
});
|
||||
const { user, mutateUser } = useUser();
|
||||
|
||||
useEffect(() => {
|
||||
if (user) router.push(destination);
|
||||
if (user && user.isVerified) router.push(destination);
|
||||
}, [router, user, destination]);
|
||||
|
||||
const forgotPassword = () => {
|
||||
@@ -173,7 +170,7 @@ export default function Login({ destination = "/" }: { destination?: string }) {
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
{/* {user && !user.isVerified && <EmailVerification user={user} isLoading={isLoading} setIsLoading={setIsLoading} />} */}
|
||||
{user && !user.isVerified && <EmailVerification user={user} isLoading={isLoading} setIsLoading={setIsLoading} />}
|
||||
</section>
|
||||
</main>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user