Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase 在Flatter中进行身份验证后,如何检查firestore中的特定字段? 我在firestore“isEnabled”中有一个字段,它包含布尔值。因此,如果它等于true,则用户登录到应用程序,并提示其进入主页 如果“isEnabled”字段等于false,则应显示一条消息,说明您的帐户已禁用 现在,我可以登录,然后检查字段,如果为false,则用户将注销 是否有任何方式可以进行首次身份验证,然后将用户带到一个页面,其中显示“检查更多详细信息…”类加载页面,如果“isEnabled”字段为false,则表明您的帐户已被禁用 我以前试过对场地进行检查,但之后就不可能了 一旦执行上述行,用户就会明显地被提示进入主页 我能实现的代码如下所示-_Firebase_Flutter_Firebase Realtime Database_Google Cloud Firestore_Firebase Authentication - Fatal编程技术网

Firebase 在Flatter中进行身份验证后,如何检查firestore中的特定字段? 我在firestore“isEnabled”中有一个字段,它包含布尔值。因此,如果它等于true,则用户登录到应用程序,并提示其进入主页 如果“isEnabled”字段等于false,则应显示一条消息,说明您的帐户已禁用 现在,我可以登录,然后检查字段,如果为false,则用户将注销 是否有任何方式可以进行首次身份验证,然后将用户带到一个页面,其中显示“检查更多详细信息…”类加载页面,如果“isEnabled”字段为false,则表明您的帐户已被禁用 我以前试过对场地进行检查,但之后就不可能了 一旦执行上述行,用户就会明显地被提示进入主页 我能实现的代码如下所示-

Firebase 在Flatter中进行身份验证后,如何检查firestore中的特定字段? 我在firestore“isEnabled”中有一个字段,它包含布尔值。因此,如果它等于true,则用户登录到应用程序,并提示其进入主页 如果“isEnabled”字段等于false,则应显示一条消息,说明您的帐户已禁用 现在,我可以登录,然后检查字段,如果为false,则用户将注销 是否有任何方式可以进行首次身份验证,然后将用户带到一个页面,其中显示“检查更多详细信息…”类加载页面,如果“isEnabled”字段为false,则表明您的帐户已被禁用 我以前试过对场地进行检查,但之后就不可能了 一旦执行上述行,用户就会明显地被提示进入主页 我能实现的代码如下所示-,firebase,flutter,firebase-realtime-database,google-cloud-firestore,firebase-authentication,Firebase,Flutter,Firebase Realtime Database,Google Cloud Firestore,Firebase Authentication,谢谢 您始终可以在Firebase Auth中禁用用户,但他将无法登录 如果您仍然想在Firebase Firestore上检查isEnabled,则进行登录,不将用户引导到主屏幕,而是将其引导到验证屏幕,如果isEnabled为true则他将进入主屏幕,如果false则您将其注销 另一种解决方案是在第一次显示对话框后,在主屏幕上显示一个对话框,该对话框将运行验证逻辑。您可以始终在Firebase Auth中禁用用户,用户将无法登录 如果您仍然想在Firebase Firestore上检查isE

谢谢

您始终可以在Firebase Auth中禁用用户,但他将无法登录

如果您仍然想在Firebase Firestore上检查
isEnabled
,则进行登录,不将用户引导到主屏幕,而是将其引导到验证屏幕,如果
isEnabled
true
则他将进入主屏幕,如果
false
则您将其注销


另一种解决方案是在第一次显示对话框后,在主屏幕上显示一个对话框,该对话框将运行验证逻辑。

您可以始终在Firebase Auth中禁用用户,用户将无法登录

如果您仍然想在Firebase Firestore上检查
isEnabled
,则进行登录,不将用户引导到主屏幕,而是将其引导到验证屏幕,如果
isEnabled
true
则他将进入主屏幕,如果
false
则您将其注销


另一个解决方案是在第一次显示对话框后,在主屏幕上显示一个对话框,该对话框将运行验证逻辑。

好的。谢谢我将从应用程序中禁用该用户。我知道你可以通过firebase控制台禁用用户。好的。谢谢我将从应用程序中禁用该用户。我知道您可以通过转到firebase控制台禁用该用户。
      AuthResult result = await _auth.signInWithEmailAndPassword(email: email, password: password);
Future signInWithEmailAndPassword(String email, String password) async {
    try {
      AuthResult result = await _auth.signInWithEmailAndPassword(email: email, password: password);
      FirebaseUser user = result.user;
      print(user.uid);
      final firestore = Firestore.instance;
      /*
      retrieving the fields from the database for checking the isEnabled field
       */
      await firestore.collection("admins").document(user.uid).get().then((resp) {
        logoutToast();
        if ((resp.data["isEnabled"]) == false) {
          disableToast();
          signOut();

        } else {
          loginToast();

        }
        return user;
      });
      //print(qn);
      //return user;
    } catch (error) {
      print(error.toString());
      return null;
    }
  }