【发布时间】:2019-04-03 21:50:47
【问题描述】:
我目前正在使用 Flutter 创建应用。
目标是在登录之前检查帐户的电子邮件是否经过验证。
现在,用户使用Auth.signInWithEmailAndPassword 登录到他们的帐户
此时,Auth.isEmailVerified 返回 false
之后,会发送一封验证电子邮件,然后用户单击链接以验证他们的帐户,并弹出一个窗口,说明他们的帐户现已通过验证。
用户尝试再次登录,但 Auth.isEmailVerified 仍然返回 false。
有什么想法吗?
这是我正在使用的auth.dart 类文件。
https://github.com/AndriousSolutions/auth/blob/master/lib/auth.dart
这是我的代码。
child: MaterialButton(
minWidth: 200.0,
height: 42.0,
onPressed: () async {
if (_formKey.currentState.validate()) {
Auth.signInWithEmailAndPassword(
email: emailAddressController.text,
password: passwordController.text)
.then((onSuccess) {
Auth.reload();
if ((onSuccess)) {
if (Auth.isEmailVerified) {
db.createUser(
emailAddress: Auth.email,
firstName: Tools.getFirstName(Auth.displayName),
googleAccount: false);
Navigator.of(context).pushReplacementNamed(HomePage.tag);
} else {
emailVerificationDialog(context);
Auth.sendEmailVerification();
}
}
}).catchError((e) {
print(" LSAHJDSAKHDSA " + e);
});
}
},
color: ThemeSettings.RaisedButtonColor,
child: Text('Log In', style: TextStyle(color: Colors.white)),
),
非常感谢!!
【问题讨论】:
标签: firebase dart flutter email-verification