<commit_before>/*global angular*/
var app = angular.module("catthings_app", ['ui.bootstrap', 'ngMockE2E', 'ui.router']);

//UI Router Config
app.config(function($stateProvider, $urlRouterProvider) {

    // For any unmatched url, send to /index
    $urlRouterProvider.otherwise("/");

    $stateProvider
        .state('login', {
          url: "/",
          templateUrl: 'templates/html/login.html',
          controller: "LoginCheckController"
        })
        .state('home', {
          url: "/home",
          templateUrl: 'templates/html/home.html'
        })
        .state('request',{
          url: "/request",
          templateUrl: 'templates/html/request.html'
        })
        .state('cart', {
          url: "/cart",
          templateUrl: 'templates/html/cart.html'
        });
});

//Login Controller
app.controller('LoginCheckController', ['$scope', '$location','$rootScope','$http', LoginCheckController]);
function LoginCheckController($scope, $location, $rootScope, $http) {
    // Can be used for Admin login
    $scope.user = {};

    $scope.showAdminLogin = false;
    $scope.LoginCheck = function() {
      var loginData = $scope.user
      var config ={
               headers : {
                   'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
               }
           };
      $http.post('https://localhost:3000/authenticate', loginData).then(function(response){
        if(response.status == 200){
          $rootScope.username = response.header['username'];
          $rootScope.isAdmin = response.header['admin'];
        };
      });
      $rootScope.username = $scope.username;
      $location.path("home");
<commit_msg>fixed the reading of response headers<commit_after>/*global angular*/
var app = angular.module("catthings_app", ['ui.bootstrap', 'ngMockE2E', 'ui.router']);

//UI Router Config
app.config(function($stateProvider, $urlRouterProvider) {

    // For any unmatched url, send to /index
    $urlRouterProvider.otherwise("/");

    $stateProvider
        .state('login', {
          url: "/",
          templateUrl: 'templates/html/login.html',
          controller: "LoginCheckController"
        })
        .state('home', {
          url: "/home",
          templateUrl: 'templates/html/home.html'
        })
        .state('request',{
          url: "/request",
          templateUrl: 'templates/html/request.html'
        })
        .state('cart', {
          url: "/cart",
          templateUrl: 'templates/html/cart.html'
        });
});

//Login Controller
app.controller('LoginCheckController', ['$scope', '$location','$rootScope','$http', LoginCheckController]);
function LoginCheckController($scope, $location, $rootScope, $http) {
    // Can be used for Admin login
    $scope.user = {};

    $scope.showAdminLogin = false;
    $scope.LoginCheck = function() {
      var loginData = $scope.user
      var config ={
               headers : {
                   'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
               }
           };
      $http.post('https://localhost:3000/authenticate', loginData).then(function(response){
        if(response.status == 200){
          console.log(response);
          console.log(response.headers);
          $rootScope.username = response.headers('username');
          $rootScope.isAdmin = response.headers('admin');
          $rootScope.token = response.headers('token');
        };
      });
      $rootScope.username = $scope.username;
      $location.path("home");

{'fraction_non_alphanumeric': 0.15974985787379192, 'fraction_numerical': 0.00511654349061967, 'mean_word_length': 2.396718146718147, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4599190', 'n_tokens_mistral': 1000, 'n_tokens_neox': 971, 'n_words': 177}