验证工作顺利进行,我收到了相关电子邮件,但即使 我没有点击验证链接,我成功登录到我的应用程序。
请问我该如何解决?
我的验证实现是这样的:
final FirebaseUser user = mAuth.getCurrentUser();
if (user.isEmailVerified())
{
Toast.makeText(this, "Email is verified", Toast.LENGTH_SHORT).show();
} else
{
Toast.makeText(this, "Email is not verified", Toast.LENGTH_SHORT).show();
user.sendEmailVerification()
.addOnCompleteListener(this, new OnCompleteListener() {
@Override
public void onComplete(@NonNull Task task) {
// Re-enable button
// findViewById(R.id.verify_email_button).setEnabled(true);
if (task.isSuccessful()) {
Toast.makeText(AccountTypeActivity.this//EmailPasswordActivity.this
,"Verification email sent to " + user.getEmail(), Toast.LENGTH_LONG).show();
} else {
Log.e(TAG, "sendEmailVerification", task.getException());
Toast.makeText(AccountTypeActivity.this//EmailPasswordActivity.this
, "Failed to send verification email.",
Toast.LENGTH_LONG).show();
}
}
});
}
答案 0 :(得分:1)
好,我是一个愚蠢的人。 解决的办法是将其放置到登录页面上。 做到了,一切正常!!!
if (user.isEmailVerified())
{
Toast.makeText(this, "Email is verified", Toast.LENGTH_SHORT).show();
openmainactivity();
} else
{
Toast.makeText(this, "Verify your email!!", Toast.LENGTH_SHORT).show();
mauth.signout();
}