Firebase检查是否存在未注册用户的电子邮件-颤振
在Flatter中,我想检查用户的电子邮件是否存在于firebase auth中,而不注册用户。如果电子邮件确实存在,那么它将显示一个不同的表单来告诉用户登录。否则,他们将进入一个问题页面,在将用户注册到数据库之前,他们将首先完成该页面 调用firebase创建用户方法的代码Firebase检查是否存在未注册用户的电子邮件-颤振,firebase,flutter,dart,firebase-authentication,Firebase,Flutter,Dart,Firebase Authentication,在Flatter中,我想检查用户的电子邮件是否存在于firebase auth中,而不注册用户。如果电子邮件确实存在,那么它将显示一个不同的表单来告诉用户登录。否则,他们将进入一个问题页面,在将用户注册到数据库之前,他们将首先完成该页面 调用firebase创建用户方法的代码 void validateAndSubmit() async { setState(() { _errorMessage = ""; _isLoading = tru
void validateAndSubmit() async {
setState(() {
_errorMessage = "";
_isLoading = true;
});
if (validateAndSave()) {
String userId = "";
try {
userId = await widget.auth.signUp(_email, _password);
print('Signed up user: $userId');
setState(() {
_isLoading = false;
});
} catch (e) {
print('Error: $e');
setState(() {
Navigator.push(context,
MaterialPageRoute(builder: (context) => QuestionsPage()));
_isLoading = false;
_errorMessage = e.message;
_formKey.currentState.reset();
});
}
}
}
存储身份验证方法代码的我的文件
Future<String> signUp(String email, String password) async {
AuthResult result = await _firebaseAuth.createUserWithEmailAndPassword(
email: email, password: password);
FirebaseUser user = result.user;
return user.uid;
}
未来注册(字符串电子邮件、字符串密码)异步{
AuthResult结果=等待_firebaseAuth.createUserWithEmailAndPassword(
电子邮件:电子邮件,密码:密码);
FirebaseUser=result.user;
返回user.uid;
}
firebase auth库中不存在此类选项。
但我建议您在firebase firestore数据库中创建一个集合,并将所有电子邮件存储在其中,并在需要时阅读该文件。您正在查找。我很确定不久前有人问过这个问题,所以我会找到一个副本。这将导致“还有一件事”保持同步。