<commit_before>angular.module('authFactory', ['firebase'])

.factory('Auth', ['$firebaseAuth', '$firebaseArray', function ($firebaseAuth, $firebaseArray){

	var authFactory = {};
	var ref = new Firebase('https://bizgramer.firebaseio.com/');

	var authObj = $firebaseAuth(ref);
  authFactory.getAuth= function(callback){
    var authData = authObj.$getAuth();
    console.log(authData);
    callback(authData);
  };

  authFactory.signin = function(email,password,callback){
    authObj.$authWithPassword({
        email: email,
        password: password
      }).then(function(authData){
      data = authData;
      console.log('logged in as '+authData.uid);
      callback(data);
    }).catch(function(error){
      console.log('Error:',error);
    });
  };

  authFactory.signup = function(email, password, orgId, orgName, callback, vm){
    var orgRef = new Firebase('https://bizgramer.firebaseio.com/'+orgName);
    var orgArr = $firebaseArray(orgRef);
    orgArr.$loaded()
      .then(function() {
        if(orgArr.$getRecord('orgKey')['$value'] === orgId) {
          authObj.$createUser({
            email: email,
            password: password
          }).then(function(userData){
            console.log("User " + userData.uid + " created successfully!");
            authFactory.signin(email,password,callback,vm);
          }).catch(function(error){
            console.log('Error:',error);
          });
        } else {
          console.log('incorrect Id for ', orgName);
        }
      })
      .catch(function (error) {
        console.log('error', error);
      });
	};

	authFactory.signout = function(){
		authObj.$unauth();
	};

	return authFactory;
}]);<commit_msg>(bug) loging out redirect to landing page<commit_after>angular.module('authFactory', ['firebase'])

.factory('Auth', ['$firebaseAuth', '$firebaseArray', '$state', function ($firebaseAuth, $firebaseArray, $state){

	var authFactory = {};
	var ref = new Firebase('https://bizgramer.firebaseio.com/');

	var authObj = $firebaseAuth(ref);
  authFactory.getAuth= function(callback){
    var authData = authObj.$getAuth();
    console.log(authData);
    callback(authData);
  };

  authFactory.signin = function(email,password,callback){
    authObj.$authWithPassword({
        email: email,
        password: password
      }).then(function(authData){
      data = authData;
      console.log('logged in as '+authData.uid);
      callback(data);
    }).catch(function(error){
      console.log('Error:',error);
    });
  };

  authFactory.signup = function(email, password, orgId, orgName, callback, vm){
    var orgRef = new Firebase('https://bizgramer.firebaseio.com/'+orgName);
    var orgArr = $firebaseArray(orgRef);
    orgArr.$loaded()
      .then(function() {
        if(orgArr.$getRecord('orgKey')['$value'] === orgId) {
          authObj.$createUser({
            email: email,
            password: password
          }).then(function(userData){
            console.log("User " + userData.uid + " created successfully!");
            authFactory.signin(email,password,callback,vm);
          }).catch(function(error){
            console.log('Error:',error);
          });
        } else {
          console.log('incorrect Id for ', orgName);
        }
      })
      .catch(function (error) {
        console.log('error', error);
      });
	};

	authFactory.signout = function(){
		authObj.$unauth();
    $state.go('landing');
	};

	return authFactory;
}]);
{'fraction_non_alphanumeric': 0.1657986111111111, 'fraction_numerical': 0.0, 'mean_word_length': 2.959908361970218, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '4105061', 'n_tokens_mistral': 1051, 'n_tokens_neox': 1030, 'n_words': 181}