Skip to content

Commit

Permalink
hotfix(con/tp): show "you're not verified" error to unverified users …
Browse files Browse the repository at this point in the history
…trying to log in
  • Loading branch information
ericbolikowski committed Sep 22, 2023
1 parent ac5e497 commit d59fe01
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/redi-connect/src/pages/front/login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions apps/redi-talent-pool/src/pages/front/login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d59fe01

Please sign in to comment.