Pau*_*ham 8 firebase firebase-authentication angular
我了解,要检查用户的电子邮件是否已经过验证,我可以使用
firebase.auth().onAuthStateChanged((user) => {
console.log(user["emailVerified"]);
})
Run Code Online (Sandbox Code Playgroud)
不过我的问题是,只要用户在收件箱中验证了他们的电子邮件地址,我就会观察/收听并重定向到另一个页面.
根据我的测试,当用户登录,更新其个人资料并注销时会触发onAuthStateChanged,但在用户在其收件箱中验证其电子邮件地址时不会触发.
无论如何我可以检测到用户何时被验证并自动重定向到另一个页面?
我设法通过 setInterval 函数使其工作,该函数每秒检查用户的 emailVerified 属性,如下所示:
setInterval(function() {
firebase.auth().currentUser.reload();
if (firebase.auth().currentUser.emailVerified) {
console.log("Email Verified!");
this.navCtrl.setRoot(HomePage);
}
}, 1000);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
737 次 |
| 最近记录: |