如何检查给定的电子邮件是否存在于 firebase 身份验证中?

How to check if a given email is present in firebase auth?

我想实现重设密码表单。为此,我需要检查用户 input 在输出文本字段中的文本输入电子邮件是否存在于我们的 firebase 身份验证数据库中,如果存在,我可以发送重置密码邮件或否则向他显示一个弹出对话框以纠正电子邮件。

我已经应用了电子邮件检查部分,我检查文本是否为 Email

Firebase Auth 实际上可以为您管理。只需像这样调用 sendPasswordResetEmail() 方法:

_auth.sendPasswordResetEmail(email: email)
        .then((void v) => {
          // password reset email sent successfully
        })
        .catchError((Error error) => {
          // There was an error verifying the email
          // Check the output of error.toString()
          // This is where you may want to show a pop-up dialog
        });

如果电子邮件格式错误或电子邮件不在 Auth 数据库中,代码将始终执行 catchError 方法。