Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.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
Javascript 如何让用户登录爱奥尼亚应用程序?_Javascript_Angularjs_Firebase_Ionic Framework_Firebase Authentication - Fatal编程技术网

Javascript 如何让用户登录爱奥尼亚应用程序?

Javascript 如何让用户登录爱奥尼亚应用程序?,javascript,angularjs,firebase,ionic-framework,firebase-authentication,Javascript,Angularjs,Firebase,Ionic Framework,Firebase Authentication,我正在用Ionic Framework开发一个应用程序,我在Android上做了一个测试,到目前为止,它工作得很好,只是在几分钟不活动后,该应用程序要求用户使用凭据重新登录 我希望用户永远不必使用“记住我”功能重新登录,也许 如何进行 这是我的控制器: .controller('loginController',['$scope', '$firebaseArray', 'CONFIG', '$document', '$state', function($scope, $firebaseArray

我正在用Ionic Framework开发一个应用程序,我在Android上做了一个测试,到目前为止,它工作得很好,只是在几分钟不活动后,该应用程序要求用户使用凭据重新登录

我希望用户永远不必使用“记住我”功能重新登录,也许

如何进行

这是我的控制器:

.controller('loginController',['$scope', '$firebaseArray', 'CONFIG', '$document', '$state', function($scope, $firebaseArray, CONFIG, $document, $state) {
  // Perform the login action when the user submits the login form
  $scope.doLogin = function(userLogin) {
        if($document[0].getElementById("user_name").value != "" && $document[0].getElementById("user_pass").value != ""){
        firebase.auth().signInWithEmailAndPassword(userLogin.username, userLogin.password).then(function() {
                      $state.go("tab.favorites");

        }, function(error) {
          // An error happened.
          var errorCode = error.code;
          var errorMessage = error.message;

          if (errorCode === 'auth/invalid-email') {
             alert('Enter a valid email.');
             return false;
          }else if (errorCode === 'auth/wrong-password') {
             alert('Incorrect password.');
             return false;
          }else if (errorCode === 'auth/argument-error') {
             alert('Password must be string.');
             return false;
          }else if (errorCode === 'auth/user-not-found') {
             alert('No such user found.');
             return false;
          }else if (errorCode === 'auth/too-many-requests') {
             alert('Too many failed login attempts, please try after sometime.');
             return false;
          }else if (errorCode === 'auth/network-request-failed') {
             alert('Request timed out, please try again.');
             return false;
          }else {
             alert(errorMessage);
             return false;
          }
        });
    }else{
        alert('Please enter email and password');
        return false;
    }//end check client username password
  };// end $scope.doLogin()
}])

这里没有说明什么会导致用户多次登录。这是执行身份验证的代码,而不是调用它的代码,因此不是重复调用的源代码。请参阅和。您好,没有多次呼叫,只是当用户让应用程序在后台运行大约20分钟,然后就像应用程序重新启动一样,需要用户再次进行身份验证。嘿,FrenchyNYC,ionic/cordova应用程序环境中的Firebase身份验证状态在本地存储中保持不变。如果清除,则状态将被清除,并要求用户再次登录。