你是如何记住我或与AngualarFire签约的?

时间:2016-07-21 12:27:52

标签: angularjs firebase angularfire firebase-authentication

或使用普通的电子邮件和密码方法,以便我每次打开应用程序时都不必登录。只需通过..

.controller('signupCtrl', function(taskref, $scope, $firebaseArray, $state, $firebaseAuth) {

      var fbref = $firebaseAuth(taskref);


      $scope.createUser = function() {
        taskref.$createUser({
            email: $scope.email,
            password: $scope.password
          })
          .then(function(authData) {
              $state.go('settings');

            };

          })

使用googleAuth或电子邮件和密码方法登录此功能

.controller('googleSignUpCtrl', function(taskref, $scope, $firebaseObject, $firebaseAuth, $state) {
  $scope.googleSignIn = function() {
    var authData = taskref.getAuth();

    taskref.authWithOAuthPopup("google", function(error, authData) {

      if (error) {
        console.log("Login Failed!", error);
      } else {
        taskref.child("users").child(authData.uid).once("value",           function(snapshot) {
          var ifExists = snapshot.exists();

          if (ifExists) {

            $state.go('tabsController.pendingTasks');
            console.log("user already exists");
          } else {
            $state.go('settings');
            $scope.authData = authData;
          }
        });
      }
    }, {
      remember: "sessionOnly",
      scope: "email"
    });
  }
})

0 个答案:

没有答案