我有一个Android Kotlin应用程序,需要在其中创建一个登录表单。现在,我正在尝试创建-reset password
之类的功能。那很好,但是除了一件小事。我的代码不想捕获ERROR_USER_DISABLED
异常。你能告诉我为什么吗?我的代码捕获了除此以外的其他异常。
mAuth.sendPasswordResetEmail(email).addOnCompleteListener { task ->
if (task.isSuccessful) {
// everything's okay!
Toast.makeText(this, "Check your email box!", Toast.LENGTH_LONG).show()
} else {
when ((task.exception as FirebaseAuthException).errorCode) {
"ERROR_INVALID_EMAIL" -> {
mInputLayoutEmail.error = "Email isn't valid!"
}
// it isn't caught. why?
"ERROR_USER_DISABLED" -> {
showDialogMessage("Your account has been disabled!")
}
"ERROR_USER_NOT_FOUND" -> {
showDialogMessage("User not found!")
}
}
}
}