<commit_before>
angular.module('simpleLogin', ['firebase', 'firebase.utils', 'changeEmail'])

  // a simple wrapper on simpleLogin.getUser() that rejects the promise
  // if the user does not exists (i.e. makes user required)
  .factory('requireUser', ['simpleLogin', '$q', function(simpleLogin, $q) {
    return function() {
      return simpleLogin.getUser().then(function (user) {
        return user ? user : $q.reject({ authRequired: true });
      });
    }
  }])

  .factory('simpleLogin', ['$firebaseSimpleLogin', 'fbutil', 'createProfile', 'changeEmail', '$q', '$rootScope',
    function($firebaseSimpleLogin, fbutil, createProfile, changeEmail, $q, $rootScope) {
      var auth = $firebaseSimpleLogin(fbutil.ref());
      var fbref = fbutil.ref();
      var listeners = [];
      
      function statusChange() {
        fns.getUser().then(function(user) {
          fns.user = user || null;
          angular.forEach(listeners, function(fn) {
            fn(user||null);
          });
        });
      }

      var fns = {
        user: null,

        getUser: function() {
          // return auth.$getCurrentUser();
          var deferred = $q.defer();
          var auth = fbref.getAuth();
          if (auth === null){
                deferred.reject('');
            } else {
                deferred.resolve(auth);              
            }
          return deferred.promise;
        },

        /**
         * @param {string} email
         * @param {string} pass
         * @returns {*}
         */
        login: function(email, pass) {
            /*
          return auth.$login('password', {
            email: email,
            password: <PASSWORD>,
            rememberMe: true
          });*/
            var deferred = $q.defer();
            deferred.notify('about to signin.');
            fbref.authWithPassword({'email': email, 'password':pass}, 
            function(error, authData){
                if (error === null){
                    console.log('userId: ' + authData.uid + ' password.email: ' + authData.password.email);
                    deferred.resolve(authData);<commit_msg>Revert "getAuth handle null result."<commit_after>
angular.module('simpleLogin', ['firebase', 'firebase.utils', 'changeEmail'])

  // a simple wrapper on simpleLogin.getUser() that rejects the promise
  // if the user does not exists (i.e. makes user required)
  .factory('requireUser', ['simpleLogin', '$q', function(simpleLogin, $q) {
    return function() {
      return simpleLogin.getUser().then(function (user) {
        return user ? user : $q.reject({ authRequired: true });
      });
    }
  }])

  .factory('simpleLogin', ['$firebaseSimpleLogin', 'fbutil', 'createProfile', 'changeEmail', '$q', '$rootScope',
    function($firebaseSimpleLogin, fbutil, createProfile, changeEmail, $q, $rootScope) {
      var auth = $firebaseSimpleLogin(fbutil.ref());
      var fbref = fbutil.ref();
      var listeners = [];
      
      function statusChange() {
        fns.getUser().then(function(user) {
          fns.user = user || null;
          angular.forEach(listeners, function(fn) {
            fn(user||null);
          });
        });
      }

      var fns = {
        user: null,

        getUser: function() {
          // return auth.$getCurrentUser();
          var deferred = $q.defer();
          deferred.resolve(fbref.getAuth());              
          return deferred.promise;
        },

        /**
         * @param {string} email
         * @param {string} pass
         * @returns {*}
         */
        login: function(email, pass) {
            /*
          return auth.$login('password', {
            email: email,
            password: <PASSWORD>,
            rememberMe: true
          });*/
            var deferred = $q.defer();
            deferred.notify('about to signin.');
            fbref.authWithPassword({'email': email, 'password':<PASSWORD>}, 
            function(error, authData){
                if (error === null){
                    console.log('userId: ' + authData.uid + ' password.email: ' + authData.password.email);
                    deferred.resolve(authData);
{'fraction_non_alphanumeric': 0.14913127413127414, 'fraction_numerical': 0.0, 'mean_word_length': 1.9438920454545454, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4586261', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1133, 'n_words': 253}