<commit_before>'use strict';

// Authentication service for user variables
angular.module('users').factory('Authentication',
  ['$http', '$cookies', '$stateParams', '$rootScope',
  function($http, $cookies, $stateParams, $rootScope) {
    function broadcastAuthentication(signedIn) {
      $rootScope.$broadcast('signinChange', signedIn);
    }
    return {
      signin: function(user, success, error) {
        $http.post('/auth/signin', user).success(function(response) {
          $cookies.putObject('user', response);
          broadcastAuthentication(true);
          success();
        }).error(function(response) {
          error(response);
        });
      },
      signout: function(success, error) {
        $http.post('/auth/signout', {}).success(
          function(response) {
            $cookies.remove('user');
            broadcastAuthentication(false);
            success();
          }).error(function(response) {
            error(response);
          });
      },
      signup: function(user, success, error) {
        $http.post('/auth/signup', user).success(function(response) {
          $cookies.putObject('user', response);
          broadcastAuthentication(true);
          success();
        }).error(function(response) {
          error(response);
        });
      },
      currentUser: function() {
        return $cookies.getObject('user');
      },
      requestPasswordReset: function(user, success, error) {
        $http.post('/auth/forgot', user).success(function(response) {
          success(response);
        }).error(function(response) {
          error(response);
        });
      },
      resetPassword: function(passwordDetails, success, error) {
        $http.post('/auth/reset/' + $stateParams.token, passwordDetails).
            success(function(response) {
              success(response);
            }).
            error(function(response) {
              error(response);
            });
      }
    };
  }
]);
<commit_msg>Sets the expiry of the log in cookie to 6 months<commit_after>'use strict';

// Authentication service for user variables
angular.module('users').factory('Authentication',
  ['$http', '$cookies', '$stateParams', '$rootScope',
  function($http, $cookies, $stateParams, $rootScope) {
    function broadcastAuthentication(signedIn) {
      $rootScope.$broadcast('signinChange', signedIn);
    }
    return {
      signin: function(user, success, error) {
        $http.post('/auth/signin', user).success(function(response) {
          var expiryDate = new Date();
          expiryDate.setMonth(expiryDate.getMonth() + 6);
          $cookies.putObject('user', response, {
            expires: expiryDate
          });
          broadcastAuthentication(true);
          success();
        }).error(function(response) {
          error(response);
        });
      },
      signout: function(success, error) {
        $http.post('/auth/signout', {}).success(
          function(response) {
            $cookies.remove('user');
            broadcastAuthentication(false);
            success();
          }).error(function(response) {
            error(response);
          });
      },
      signup: function(user, success, error) {
        $http.post('/auth/signup', user).success(function(response) {
          $cookies.putObject('user', response);
          broadcastAuthentication(true);
          success();
        }).error(function(response) {
          error(response);
        });
      },
      currentUser: function() {
        return $cookies.getObject('user');
      },
      requestPasswordReset: function(user, success, error) {
        $http.post('/auth/forgot', user).success(function(response) {
          success(response);
        }).error(function(response) {
          error(response);
        });
      },
      resetPassword: function(passwordDetails, success, error) {
        $http.post('/auth/reset/' + $stateParams.token, passwordDetails).
            success(function(response) {
              success(response);
            }).
            error(function(response) {
              error(response);
            });
      }
    };
  }
]);

{'fraction_non_alphanumeric': 0.15061549601737872, 'fraction_numerical': 0.0004827419744146754, 'mean_word_length': 2.2501960784313724, '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': '6613480', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1082, 'n_words': 178}