I am facing a challenge with my website that only accepts emails from a specific domain, such as a university domain. Users who want to sign up using Facebook or Google need to verify their university email, but I am struggling to find a way to send the verification email to these addresses.
I have attempted different methods:
SendVerificationEmailSocialMedial(email) {
return this.afsAuth.auth.currentUser.sendEmailVerication(email)
.catch((error) => {
window.alert(error)
})
}
SendVerificationEmailSocialMedial(email) {
return this.afsAuth.auth.email.sendEmailVerification()
.catch((error) => {
window.alert(error)
})
}
Out of all the attempts, only one solution has worked:
SendVerificationEmailSocialMedial(email){
return new Promise((resolve, reject) => {
this.afsAuth.auth.currentUser.updateEmail(email)
.then(userData => {
this.SendVerificationMail();
}).catch(err => console.log(reject(err)))
});
}
Although this solution changes the user's email temporarily, it successfully sends the verification email without permanently altering the email address.
As an alternative approach, I am considering changing the user's email, sending the verification, and then reverting back to the original email. While I'm not certain if this method will work, it could be a potential workaround for the issue at hand.