in my App, I use firebase database and the auth-service for new registrations.
The new user will be added to the authentification users-list, but there is still one missing part. The new user won't be added to database collection 'users'.
Is there any service in firebase to add new users to the database if they have the status emailVerified: true
or do I have to do this on the client side? Thank you for your hints!
SendVerificationMail() {
// Email verification when new user register
return this.ngFireAuth.auth.currentUser.sendEmailVerification() .then(()=> {
this.router.navigate(['verify-email']);
})
}
SetUserData(user) {
const userRef: AngularFirestoreDocument<any>=this.afStore.doc(`users/$ {
user.uid
}
`);
const userData: User= {
uid: user.uid, email: user.email, displayName: user.displayName, photoURL: user.photoURL, emailVerified: user.emailVerified
}
return userRef.set(userData, {
merge: true
}
)
}