<commit_before>/**
 * Register controller
 * @namespace crowdsource.authentication.controllers
 */
(function () {
    'use strict';

    angular
        .module('crowdsource.authentication.controllers')
        .controller('RegisterController', ['$state', '$scope', 'Authentication', '$mdToast',
            function RegisterController($state, $scope, Authentication, $mdToast) {

                activate();
                /**
                 * @name activate
                 * @desc Actions to be performed when this controller is instantiated
                 * @memberOf crowdsource.authentication.controllers.RegisterController
                 */
                function activate() {
                    // If the user is authenticated, they should not be here.
                    if (Authentication.isAuthenticated()) {
                        $state.go('profile');
                    }
                }

                var vm = this;

                vm.register = register;
                vm.errors = [];

                /**
                 * @name register
                 * @desc Register a new user
                 * @memberOf crowdsource.authentication.controllers.RegisterController
                 */
                function register(isValid) {
                    if (isValid) {
                        Authentication.register(vm.email, vm.firstname, vm.lastname,
                            vm.password1, vm.password2).then(function () {

                                $state.go('login');
                                $mdToast.showSimple('Email with an activation link has been sent.');
                            }, function (data, status) {

                                //Global errors
                                if (data.data.hasOwnProperty('detail')) {
                                    vm.error = data.data.detail;
                                    $scope.form.$setPristine();
                                }

                                angular.forEach(data.data, function (errors, field) {

                                    if (field == 'non_field_errors') {
                                        // Global errors
                                        vm.error = errors.join(', ');
                                        $scope.form.$setPristine();
                                    } else {
                                        //Field level errors
                                        $scope.form[field].$setValidity('backend', false);
                                        $scope.form[field].$dirty = true;
                                        vm.errors[field] = errors.join(', ');
                                    }
                                });

                            }).finally(function () {
                            });
                    }
                    vm.submitted = true;
                }
            }]);
})();<commit_msg>fix login route after signup<commit_after>/**
 * Register controller
 * @namespace crowdsource.authentication.controllers
 */
(function () {
    'use strict';

    angular
        .module('crowdsource.authentication.controllers')
        .controller('RegisterController', ['$state', '$scope', 'Authentication', '$mdToast',
            function RegisterController($state, $scope, Authentication, $mdToast) {

                activate();
                /**
                 * @name activate
                 * @desc Actions to be performed when this controller is instantiated
                 * @memberOf crowdsource.authentication.controllers.RegisterController
                 */
                function activate() {
                    // If the user is authenticated, they should not be here.
                    if (Authentication.isAuthenticated()) {
                        $state.go('profile');
                    }
                }

                var vm = this;

                vm.register = register;
                vm.errors = [];

                /**
                 * @name register
                 * @desc Register a new user
                 * @memberOf crowdsource.authentication.controllers.RegisterController
                 */
                function register(isValid) {
                    if (isValid) {
                        Authentication.register(vm.email, vm.firstname, vm.lastname,
                            vm.password1, vm.password2).then(function () {
                            $mdToast.showSimple('Email with an activation link has been sent.');
                            $state.go('home.login');
                        }, function (data, status) {

                            //Global errors
                            if (data.data.hasOwnProperty('detail')) {
                                vm.error = data.data.detail;
                                $scope.form.$setPristine();
                            }

                            angular.forEach(data.data, function (errors, field) {

                                if (field == 'non_field_errors') {
                                    // Global errors
                                    vm.error = errors.join(', ');
                                    $scope.form.$setPristine();
                                } else {
                                    //Field level errors
                                    $scope.form[field].$setValidity('backend', false);
                                    $scope.form[field].$dirty = true;
                                    vm.errors[field] = errors.join(', ');
                                }
                            });

                        }).finally(function () {
                        });
                    }
                    vm.submitted = true;
                }
            }]);
})();
{'fraction_non_alphanumeric': 0.09774952757258203, 'fraction_numerical': 0.000687167153410067, 'mean_word_length': 0.9233564585398084, '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': 23, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2012446', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1148, 'n_words': 240}