<commit_before>const template = require('./login.html');
const mainSong = require('../../public/music/Main.ogg');

export const LoginCtrlName = 'LoginCtrl';

export const LoginCtrlState = {
  url: '/login',
  template,
  controller: LoginCtrlName,
  controllerAs: 'login',
  params: {
    errorMessage: null
  }
};

export const UserServices = [

 '$http', '$state', 'TimerService',

  class UserServices {
    constructor ($http, $state, users, TimerService) {
      this.$http = $http;
      this.$state = $state;
      this.users = users;
      TimerService.resetGame();
    }

    getUsers (userData) {
      this.data = userData;
      const req ={
       method: 'POST',
       url: `/api/login`,
       headers: {
         'Content-Type': 'application/x-www-form-urlencoded'
       },
       data: `username=${userData.username}&password=${<PASSWORD>}&=`
      };
      return this.$http(req)
        .success(response => {
          if(response.success === true){
            this.$state.go('splash');
          } else {
            this.$state.go('login', {errorMessage: response.errorMessage});
          }
          return;
        });
    }
  }
];

export const LoginCtrl = [
  '$scope', 'UserServices', '$state', '$stateParams',
  '$rootScope', 'LocalStorageService', '$q',

  class LoginCtrl {
    constructor($scope, UserServices, $state, $stateParams,
      $rootScope, LocalStorageService, $q) {
      this.userData = {
        username: '',
        password: ''
      };

      if ($rootScope.currentSong._src !== mainSong) {
        $rootScope.setCurrentSong(mainSong);
      }


      $scope.userName = '';
      $scope.password = '';
      $scope.UserServices = UserServices;



    $scope.checkCredentials = () =>{
      this.userData.username = $scope.userName;
      this.userData.password = $<PASSWORD>;
      UserServices.getUsers(this.userData)
        .success(response =>{
          console.log('response', response);
          $rootScope.user = response.username;
          $rootScope.visible = true;
          LocalStorageService.setData('user', {userId: response.userid, userName: response.username});
        })
        .then(()=> {
          console.log('what is in the localStorage', LocalStorageService.getData('user'));
        })
    };
    $scope.errorMessage = $stateParams.errorMessage;

    $scope.goToRegistration = () => {
      $state.go('registration');
    };
  }
}
];<commit_msg>removes resetGame function on login page<commit_after>const template = require('./login.html');
const mainSong = require('../../public/music/Main.ogg');

export const LoginCtrlName = 'LoginCtrl';

export const LoginCtrlState = {
  url: '/login',
  template,
  controller: LoginCtrlName,
  controllerAs: 'login',
  params: {
    errorMessage: null
  }
};

export const UserServices = [

 '$http', '$state',

  class UserServices {
    constructor ($http, $state, users) {
      this.$http = $http;
      this.$state = $state;
      this.users = users;
    }

    getUsers (userData) {
      this.data = userData;
      const req ={
       method: 'POST',
       url: `/api/login`,
       headers: {
         'Content-Type': 'application/x-www-form-urlencoded'
       },
       data: `username=${userData.username}&password=${<PASSWORD>}&=`
      };
      return this.$http(req)
        .success(response => {
          if(response.success === true){
            this.$state.go('splash');
          } else {
            this.$state.go('login', {errorMessage: response.errorMessage});
          }
          return;
        });
    }
  }
];

export const LoginCtrl = [
  '$scope', 'UserServices', '$state', '$stateParams',
  '$rootScope', 'LocalStorageService', '$q',

  class LoginCtrl {
    constructor($scope, UserServices, $state, $stateParams,
      $rootScope, LocalStorageService, $q) {
      this.userData = {
        username: '',
        password: ''
      };

      if ($rootScope.currentSong._src !== mainSong) {
        $rootScope.setCurrentSong(mainSong);
      }


      $scope.userName = '';
      $scope.password = '';
      $scope.UserServices = UserServices;



    $scope.checkCredentials = () =>{
      this.userData.username = $scope.userName;
      this.userData.password = <PASSWORD>;
      UserServices.getUsers(this.userData)
        .success(response =>{
          console.log('response', response);
          $rootScope.user = response.username;
          $rootScope.visible = true;
          LocalStorageService.setData('user', {userId: response.userid, userName: response.username});
        })
        .then(()=> {
          console.log('what is in the localStorage', LocalStorageService.getData('user'));
        })
    };
    $scope.errorMessage = $stateParams.errorMessage;

    $scope.goToRegistration = () => {
      $state.go('registration');
    };
  }
}
];
{'fraction_non_alphanumeric': 0.15919468659194685, 'fraction_numerical': 0.0, 'mean_word_length': 2.476911976911977, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3357575', 'n_tokens_mistral': 1436, 'n_tokens_neox': 1402, 'n_words': 258}