<commit_before>angular.module('enki.auth', [])

.controller('AuthController', function ($scope, $http, $location, $window, Auth, $state) {
  // login function to be called when input form submitted
  $scope.user = {};
  $scope.signin = function (user) {
      $scope.error = '';
      if(!user) {
        var userData = {
          "username":$scope.username,
          "password":<PASSWORD>
        };
      } 
      Auth.signin(JSON.stringify($scope.user))
        .then(function(message){
          // messages is an array with one object that contains our user info
          // setting that information in local storage
          // should be refactored to use jwt at some point
          window.localStorage.setItem('com.fickle', JSON.stringify(message[0]));
          // $location.path('/search');
          $state.go('tab.searchElastic');
        })
        .catch(function (error) {
          console.error(error);
        });
    };

  // sign up function to be called when input form submitted
  $scope.signup = function () {
    clearFields();
    $scope.signUpError = '';
    Auth.signup(JSON.stringify($scope.user))
    .then(function(message){
      if(message==="existing"){
        alert("You already have an account. Please login.");
      } else {
        window.localStorage.setItem('com.fickle', JSON.stringify(message[0]));
        // $location.path('/search');
        $state.go('tab.searchElastic');
      }
    });
  };
<commit_msg>Moved clear fields in registration<commit_after>angular.module('enki.auth', [])

.controller('AuthController', function ($scope, $http, $location, $window, Auth, $state) {
  // login function to be called when input form submitted
  $scope.user = {};
  $scope.signin = function (user) {
      $scope.error = '';
      if(!user) {
        var userData = {
          "username":$scope.username,
          "password":<PASSWORD>
        };
      } 
      Auth.signin(JSON.stringify($scope.user))
        .then(function(message){
          // messages is an array with one object that contains our user info
          // setting that information in local storage
          // should be refactored to use jwt at some point
          window.localStorage.setItem('com.fickle', JSON.stringify(message[0]));
          // $location.path('/search');
          $state.go('tab.searchElastic');
        })
        .catch(function (error) {
          console.error(error);
        });
    };

  // sign up function to be called when input form submitted
  $scope.signup = function () {
    $scope.signUpError = '';
    Auth.signup(JSON.stringify($scope.user))
    .then(function(message){
      if(message==="existing"){
        alert("You already have an account. Please login.");
      } else {
        window.localStorage.setItem('com.fickle', JSON.stringify(message[0]));
        // $location.path('/search');
        $state.go('tab.searchElastic');
      }
    });
    clearFields();
  };

{'fraction_non_alphanumeric': 0.15127768313458262, 'fraction_numerical': 0.001362862010221465, 'mean_word_length': 2.4020857473928157, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 5, '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': '4094340', 'n_tokens_mistral': 832, 'n_tokens_neox': 825, 'n_words': 190}