如何知道注册电子邮件是否在 Firebase 中经过验证? [英] How to know whether the Register Email is verified or not in Firebase?
本文介绍了如何知道注册电子邮件是否在 Firebase 中经过验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
onSubmit(formData) {
if(formData.valid) {
console.log(formData.value);
this.af.auth.createUser({
email: formData.value.email,
password: formData.value.password
}).then(
authState => {
authState.auth.sendEmailVerification();
this.router.navigate(['/login'])
}).catch(
(err) => {
console.log(err);
this.error = err;
})
}
}
在Firebase中,我像上面的代码一样设置了SendEmailVerfication
,邮件可以正常发送.但是,在我的应用中,没有点击验证邮件的用户与那些被点击的,如何有所作为?
In Firebase, I set the SendEmailVerfication
like the code above, and the email could send normally.However, in my app, there is no difference between the user who does not click the verification email with those clicked, how to make a difference?
推荐答案
根据文档,User
对象包含一个 emailVerified
属性.
According to the documentation, the User
object contains an emailVerified
property.
因此,signInWithEmailAndPassword代码>
方法的承诺解析 - 或传递给 onAuthStateChanged
方法的回调 - 可以检查并且可以检查 emailVerified
的值.
这篇关于如何知道注册电子邮件是否在 Firebase 中经过验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文