<commit_before>angular.module('BecomeAHero.Register', [
	'ui.router',
	'BecomeAHero.Data.User',
	'BecomeAHero.PageTitle'
])

.config(function config( $stateProvider ) {
	$stateProvider.state('app.register', {
		url: '/register?type',
		views: {
			"app": {
				controller: 'RegisterCtrl',
				templateUrl: 'register/register.tpl.html'
			}
		}
	});
})

.controller('RegisterCtrl', function ($scope, User, $state, PageTitle, $stateParams) {
	PageTitle.setTitle("Register");

	$scope.register = register;

	
	function register(email, password, name) {
		$scope.error = "";
		var data = {
			email: email,
			password: password,
			name: name,
			isHero: $stateParams.type === "hero",
			isReporter: $stateParams.type === "reporter"
		};
		
		User.post(data).then(function() {
			User.login({ email: email }).then(function() {
				if (data.isHero) {
					$state.go("app.auth.heroDashboard");
				} else {
					$state.go("app.auth.reporterDashboard");
				}
			}, function(error) {
				$scope.error = JSON.stringify(error.data.errors);
			});
		}, function(error) {
			$scope.error = JSON.stringify(error.data.errors);
		});
	}	
})

;
<commit_msg>Pass createdAt property<commit_after>angular.module('BecomeAHero.Register', [
	'ui.router',
	'BecomeAHero.Data.User',
	'BecomeAHero.PageTitle'
])

.config(function config( $stateProvider ) {
	$stateProvider.state('app.register', {
		url: '/register?type',
		views: {
			"app": {
				controller: 'RegisterCtrl',
				templateUrl: 'register/register.tpl.html'
			}
		}
	});
})

.controller('RegisterCtrl', function ($scope, User, $state, PageTitle, $stateParams) {
	PageTitle.setTitle("Register");

	$scope.register = register;

	
	function register(email, password, name) {
		$scope.error = "";
		var data = {
			email: email,
			password: password,
			name: name,
			isHero: $stateParams.type === "hero",
			isReporter: $stateParams.type === "reporter",
			createdAt: new Date().toISOString()
		};
		
		User.post(data).then(function() {
			User.login({ email: email }).then(function() {
				if (data.isHero) {
					$state.go("app.auth.heroDashboard");
				} else {
					$state.go("app.auth.reporterDashboard");
				}
			}, function(error) {
				$scope.error = JSON.stringify(error.data.errors);
			});
		}, function(error) {
			$scope.error = JSON.stringify(error.data.errors);
		});
	}	
})

;

{'fraction_non_alphanumeric': 0.18450342465753425, 'fraction_numerical': 0.0, 'mean_word_length': 3.730769230769231, 'pattern_counts': {'":': 2, '<': 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': '2618392', 'n_tokens_mistral': 946, 'n_tokens_neox': 823, 'n_words': 127}