<commit_before>/*
	This service is used to store a login token between multiple controllers.
	Each controller will:
	- get injected the shared instance of the service
	- watch for a change on the userService.currentUser
	- on a change, it should update its $scope variable accordingly
*/
angular.module('pie')
.factory('authService', function($http, $cookieStore, $location) {
	return {
		authenticated: false,
		login: function(login, passwd, successCallback, errorCallback) {
			var t = this;
			$cookieStore.put('token', undefined);

			$http.post('http://localhost:8080/users/signin', {login:login, passwd:<PASSWORD>})
			.success(function(data) {
				$cookieStore.put('token', data.token);
				successCallback();
			})
			.error(function(data) {
				errorCallback();
			});
		},
		register: function(login, passwd, email, imgUrl, successCallback, errorCallback) {
			var t = this;
			$cookieStore.put('token', undefined);

			var u = {login:login, passwd:<PASSWORD>, email:email, img:imgUrl};
			$http.post('http://localhost:8080/users/signup', {user: u})
			.success(function(data) {
				$cookieStore.put('token', data.token);
				successCallback();
			})
			.error(function(data) {
				errorCallback();
			});
		},

		ensureLoginAndReturnToken: function() {
			if ($cookieStore.get('token') === undefined) {
				$location.path('/login');
			}
			return $cookieStore.get('token');
		}
	};
});<commit_msg>Revert "Renamed one field at registration"<commit_after>/*
	This service is used to store a login token between multiple controllers.
	Each controller will:
	- get injected the shared instance of the service
	- watch for a change on the userService.currentUser
	- on a change, it should update its $scope variable accordingly
*/
angular.module('pie')
.factory('authService', function($http, $cookieStore, $location) {
	return {
		authenticated: false,
		login: function(login, passwd, successCallback, errorCallback) {
			var t = this;
			$cookieStore.put('token', undefined);

			$http.post('http://localhost:8080/users/signin', {login:login, passwd:<PASSWORD>})
			.success(function(data) {
				$cookieStore.put('token', data.token);
				successCallback();
			})
			.error(function(data) {
				errorCallback();
			});
		},
		register: function(login, passwd, email, imgUrl, successCallback, errorCallback) {
			var t = this;
			$cookieStore.put('token', undefined);

			var u = {login:login, passwd:<PASSWORD>, email:email, imgUrl:imgUrl};
			$http.post('http://localhost:8080/users/signup', {user: u})
			.success(function(data) {
				$cookieStore.put('token', data.token);
				successCallback();
			})
			.error(function(data) {
				errorCallback();
			});
		},

		ensureLoginAndReturnToken: function() {
			if ($cookieStore.get('token') === undefined) {
				$location.path('/login');
			}
			return $cookieStore.get('token');
		}
	};
});
{'fraction_non_alphanumeric': 0.1570827489481066, 'fraction_numerical': 0.005610098176718092, 'mean_word_length': 4.244485294117647, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6430486', 'n_tokens_mistral': 1027, 'n_tokens_neox': 873, 'n_words': 211}