Only verified email can login

Hi there,

I just want to know if possible to have a feature that only user with email verified true can only log in to the website? Currently, even the user is not email verified or false value they can log in without notification.

Warm Regards

you can check that field and remove some functionality if the email is not validated

Hi cryptokid,

Thank you for the quick response, Actually, I’m using react-moralis package once I used the login hook it keeps me automatically authenticated.

Warm Regards

maybe you can use logout in react too if the field is not set

I got some workaround. But im not satisfied with it. But it’s working though.

import { useMoralis } from "react-moralis";

    const { 
    } = useMoralis();
const user = await Moralis.User.logIn(email, password); // Moralis
    if(user.get('emailVerified')) {
        await login(email, password);

you could also do a query in Moralis db to check if the email is verified before login

Unfortunately in react-moralis its not safe todo that and there is no way to query user object base on username or email and password.

Yep, you can not do that directly, you could try to use a cloud function to do that check (where you can use master key)

I see do you have some documentation how to code in cloud function?

1 Like

Thank you so much @cryptokid for the help.