Skip to content

Commit

Permalink
dispatch email on not verified users (#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro100 authored Aug 19, 2024
1 parent 6b62a3c commit 4c2e715
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion web-app/src/app/screens/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import AppleIcon from '@mui/icons-material/Apple';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { useAppDispatch } from '../hooks';
import { useRemoteConfig } from '../context/RemoteConfigProvider';
import { login, loginFail, loginWithProvider } from '../store/profile-reducer';
import {
login,
loginFail,
loginWithProvider,
verifyEmail,
} from '../store/profile-reducer';
import {
OauthProvider,
type EmailLogin,
Expand Down Expand Up @@ -110,6 +115,9 @@ export default function SignIn(): React.ReactElement {
const provider = oathProviders[oauthProvider];
signInWithPopup(auth, provider)
.then((userCredential: UserCredential) => {
if (!userCredential.user.emailVerified) {
dispatch(verifyEmail());
}
if (userCredential.user.email == null) {
setShowNoEmailSnackbar(true);
} else {
Expand Down

0 comments on commit 4c2e715

Please sign in to comment.