<commit_before>(function() {
    "use strict";

    angular
        .module('VinculacionApp')
        .controller('ActivateProfessorController', ActivateProfessorController);

    ActivateProfessorController.$inject = ['$rootScope', '$state', '$stateParams', 'professors', 'TbUtils', 'authentication'];

    function ActivateProfessorController($rootScope, $state, $stateParams, professors, TBUtils, authentication) {

        var vm = this;

        vm.professor = {
            AccountId: '',
            Password: ''
        };
        
        vm.accountId;
        vm.confirmPass = '';
        
        vm.activateProfessor = activateProfessor;
        $rootScope.globals.guest = true;
        
        leaveIfSessionStarted();
        getToken();
        
        function activateProfessor() {
            professors.activateProfessor(vm.professor, activateProfessorSuccess, activateProfessorFail);
        }
        
        function activateProfessorSuccess(response) {
            $state.go('landing');
            TBUtils.displayNotification('success', 'Usuario activado!', 'Ya puede navegar el sitio.');
        }
        
        function activateProfessorFail(response) {
            console.log(response);
            TbUtils.showErrorMessage('error', response, 'No se ha podido activar el profesor.', 'Error!');
        }
        
        function getToken() {
            if($stateParams.accountId == undefined || $stateParams.accountId == '') $state.go('landing');
            
            console.log($stateParams.accountId);
            vm.professor.AccountId = $stateParams.accountId;
        }
        
        function leaveIfSessionStarted() {
            if($rootScope.globals.token) {
                authentication.ClearCredentials();
                $state.go('landing');
            }
        }
    }
})();<commit_msg>Redirect to landing in case of failure when activating professor<commit_after>(function() {
    "use strict";

    angular
        .module('VinculacionApp')
        .controller('ActivateProfessorController', ActivateProfessorController);

    ActivateProfessorController.$inject = ['$rootScope', '$state', '$stateParams', 'professors', 'TbUtils', 'authentication'];

    function ActivateProfessorController($rootScope, $state, $stateParams, professors, TBUtils, authentication) {

        var vm = this;

        vm.professor = {
            AccountId: '',
            Password: ''
        };
        
        vm.accountId;
        vm.confirmPass = '';
        
        vm.activateProfessor = activateProfessor;
        $rootScope.globals.guest = true;
        
        leaveIfSessionStarted();
        getToken();
        
        function activateProfessor() {
            professors.activateProfessor(vm.professor, activateProfessorSuccess, activateProfessorFail);
        }
        
        function activateProfessorSuccess(response) {
            $state.go('landing');
            TBUtils.displayNotification('success', 'Usuario activado!', 'Ya puede navegar el sitio.');
        }
        
        function activateProfessorFail(response) {
            console.log(response);
            TbUtils.showErrorMessage('error', response, 'No se ha podido activar el profesor.', 'Error!');
            $state.go('landing');
        }
        
        function getToken() {
            if($stateParams.accountId == undefined || $stateParams.accountId == '') $state.go('landing');
            
            console.log($stateParams.accountId);
            vm.professor.AccountId = $stateParams.accountId;
        }
        
        function leaveIfSessionStarted() {
            if($rootScope.globals.token) {
                authentication.ClearCredentials();
                $state.go('landing');
            }
        }
    }
})();
{'fraction_non_alphanumeric': 0.11722677957131517, 'fraction_numerical': 0.0, 'mean_word_length': 2.129139072847682, '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': '4049356', 'n_tokens_mistral': 1043, 'n_tokens_neox': 953, 'n_words': 166}