From d59fe015b835ee6dcdae9ae0ae75edfa9ec775e2 Mon Sep 17 00:00:00 2001 From: Eric Bolikowski Date: Fri, 22 Sep 2023 09:55:04 +0200 Subject: [PATCH] hotfix(con/tp): show "you're not verified" error to unverified users trying to log in --- apps/redi-connect/src/pages/front/login/Login.tsx | 11 +++++++++++ apps/redi-talent-pool/src/pages/front/login/Login.tsx | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/apps/redi-connect/src/pages/front/login/Login.tsx b/apps/redi-connect/src/pages/front/login/Login.tsx index 3a2b250aa..cc8cc3333 100644 --- a/apps/redi-connect/src/pages/front/login/Login.tsx +++ b/apps/redi-connect/src/pages/front/login/Login.tsx @@ -23,6 +23,7 @@ import { useState } from 'react' import { Columns, Content, Form, Notification } from 'react-bulma-components' import { Link, useHistory } from 'react-router-dom' import * as Yup from 'yup' +import { showNotification } from '../../../components/AppNotification' import Teaser from '../../../components/molecules/Teaser' import AccountOperation from '../../../components/templates/AccountOperation' import { login } from '../../../services/api/api' @@ -85,6 +86,16 @@ export default function Login() { return } + const jwtToken = decodeJwt(getAccessTokenFromLocalStorage().jwtToken) + if (!jwtToken.emailVerified) { + formik.setSubmitting(false) + showNotification( + 'Please verify your email address first. Check your inbox.', + { variant: 'error', autoHideDuration: 8000 } + ) + return + } + // GET THEIR CON PROFILE FROM SALESFORCE try { // Load "outside" of react-query to avoid having to build diff --git a/apps/redi-talent-pool/src/pages/front/login/Login.tsx b/apps/redi-talent-pool/src/pages/front/login/Login.tsx index 2b48f8d4e..bc6a83126 100644 --- a/apps/redi-talent-pool/src/pages/front/login/Login.tsx +++ b/apps/redi-talent-pool/src/pages/front/login/Login.tsx @@ -19,6 +19,7 @@ import { useCallback, useState } from 'react' import { Columns, Content, Form } from 'react-bulma-components' import { Link } from 'react-router-dom' import * as Yup from 'yup' +import { showNotification } from '../../../components/AppNotification' import TpTeaser from '../../../components/molecules/TpTeaser' import AccountOperation from '../../../components/templates/AccountOperation' import { login } from '../../../services/api/api' @@ -80,6 +81,16 @@ export default function Login() { ) saveAccessTokenToLocalStorage(accessToken) + const jwtToken = decodeJwt(accessToken.jwtToken) + if (!jwtToken.emailVerified) { + formik.setSubmitting(false) + showNotification( + 'Please verify your email address first. Check your inbox.', + { variant: 'error', autoHideDuration: 8000 } + ) + return + } + const handler = new PostLoginSuccessHandler({ tpJobseekerSignupMutation, tpCompanySignupMutation,