I have a registration form, the user puts his info then I submit it to a firestore collection. I want to send a verification email with the same button, how can I do that?
here's my signup button.
onSignUp() {
if (
this.state.email != '' &&
this.state.password != '' &&
this.state.name != '' &&
this.state.phonenumber != '' &&
this.state.lastname != ''
) {
const { name, lastname, phonenumber, email, password} = this.state;
firebase
.auth()
.createUserWithEmailAndPassword(email, password)
.then((result) => {
firebase
.firestore()
.collection('Patients')
.doc(firebase.auth().currentUser.uid)
.set({
name,
lastname,
phonenumber,
email,
});
console.log(result);
})
.catch((error) => {
alert('Sorry it seems you entered wrong email or/and password');
console.log(error);
});
} else {
alert('Please, make sure you filled all the fields with correct info!');
}
}
CodePudding user response:
To send an email verification message call user.sendEmailVerification()
after the account was created or signed in. So:
firebase
.auth()
.createUserWithEmailAndPassword(email, password)
.then((result) => {
result.user.sendEmailVerification();
...
Also see the RNFirebase documentation for that method.
CodePudding user response:
There are too many modules which can be used. I use nodemailer.
Official website
yt video