如何使用来自AngularFire2的emailVerified来重定向未验证电子邮件的用户?

问题描述

我找不到使用emailVerified AngularFire2导出管道的示例来重定向尚未通过特定路由验证电子邮件的用户。

提供了有关如何使用redirectLoggedInTo(redirect),redirectUnauthorizedTo(redirect)和hasCustomClaim(claim)的用例。

AngularFire团队可以方便地避免在GitHub页面上放置示例:https://github.com/angular/angularfire/blob/master/docs/auth/router-guards.md

enter image description here

解决方法

尝试一下

 firebase.auth().signInWithEmailAndPassword(email,password).then(async user => { 
              if(user.user.emailVerified) {
              //email is Verified                
                 this.router.navigate(['/home']);
              }
              else {
                //email is not Verified 
                user.user.sendEmailVerification();
                this.router.navigate(['/emailVerified']);   
              }          
        });

希望对您有帮助

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...