Home > Mobile >  Tried to create user using react firebase hook though sendEmailVerification(); added but with out ve
Tried to create user using react firebase hook though sendEmailVerification(); added but with out ve

Time:05-10

const createUser = async () => {
    await createUserWithEmailAndPassword(email, password);
    await updateProfile({ displayName });
    await sendEmailVerification();enter code here
}

 <button onClick={ async () => await createUser() }>Create User</button>

CodePudding user response:

The user will receive en email with a verification link.

Clicking this link will verify this user.

However, the user is created even without verification in the database. This is normal.

But: One can check the field emailVerified of the user object.

It should more or less look something like this, for example if the user tries to login without having the email address verified:

final credential = await 
  signInWithEmailAndPassword(email: email, password: password);

if( credential.user.emailVerified == false ) ...

CodePudding user response:

const createUser = async () => {
    await createUserWithEmailAndPassword(email, password);
    await sendEmailVerification();enter code here
    if(user.emailVerfied === true){
    await updateProfile({ displayName });
    }
    
}

CodePudding user response:

You can disable user after he will create account using Firebase Functions and firebase-admin SDK. If user verify email account, you can enable his account same using Firebase Functions.

  • Related