<commit_before>'use strict';
/**
 * Created by davidl on 07/09/14.
 */
function getCookie(name) {
  var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
  return r ? r[1] : undefined;
}
angular.module('sllp.app')
  .controller('LoginController', ['$cookieStore', '$scope', '$rootScope', '$http', '$location',
    function ($cookieStore, $scope, $rootScope, $http, $location) {
      $scope.username = '';
      $scope.password = '';
      $scope.error = '';


      $scope.login = function () {
        var data = {username: $scope.username, password: $scope.password};
        $http.post('/api/login', data).success(function (data, status, headers, config) {
          // this callback will be called asynchronously
          console.log(data);
          if (data.status == 0) {
            /*
             $rootScope.userProfile = angular.copy(data.user);
             $cookieStore.put('sllp_user', data.user);
             console.log($cookieStore.get('sllp_user'));
             $scope.error = '';
             console.log('login success');
             //console.log(document.cookie);
             */
            $location.path('/');
          } else {
            $scope.error = data.error;
            $scope.username = '';
            $scope.password = '';
            console.log('login fail');
          }

        }).error(function (data, status, headers, config) {
          $scope.error = data;
        });
      };
      $scope.logout = function () {
        var data = {};
        console.log($cookieStore.get('sllp_user'));
        $http.put('/api/login', data).success(function (data, status, headers, config) {
          // this callback will be called asynchronously
          console.log(data);
          if (data.status == 0) {
            //delete $rootScope.userProfile;
            //$cookieStore.remove('sllp_user');<commit_msg>removing the isLogin isAdmin implementations<commit_after>'use strict';
/**
 * Created by davidl on 07/09/14.
 */
function getCookie(name) {
  var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
  return r ? r[1] : undefined;
}
angular.module('sllp.app')
  .controller('LoginController', ['$cookieStore', '$scope', '$rootScope', '$http', '$location',
    function ($cookieStore, $scope, $rootScope, $http, $location) {
      $scope.username = '';
      $scope.password = '';
      $scope.error = '';


      $scope.login = function () {
        var data = {username: $scope.username, password: $scope.password};
        $http.post('/api/login', data).success(function (data, status, headers, config) {
          // this callback will be called asynchronously
          console.log(data);
          if (data.status == 0) {
            /*
             $rootScope.userProfile = angular.copy(data.user);
             $cookieStore.put('sllp_user', data.user);
             console.log($cookieStore.get('sllp_user'));
             $scope.error = '';
             console.log('login success');
             //console.log(document.cookie);
             */
            $location.path('/');
          } else {
            $scope.error = data.error;
            $scope.username = '';
            $scope.password = '';
            console.log('login fail');
          }

        }).error(function (data, status, headers, config) {
          $scope.error = data;
        });
      };
      $scope.logout = function () {
        var data = {};
        //console.log($cookieStore.get('sllp_user'));
        $http.put('/api/login', data).success(function (data, status, headers, config) {
          // this callback will be called asynchronously
          console.log(data);
          if (data.status == 0) {
            //delete $rootScope.userProfile;
            //$cookieStore.remove('sllp_user');
{'fraction_non_alphanumeric': 0.17203728362183754, 'fraction_numerical': 0.004793608521970706, 'mean_word_length': 2.0661224489795917, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5305776', 'n_tokens_mistral': 1090, 'n_tokens_neox': 1062, 'n_words': 215}