<commit_before>'use strict';

angular.module('admin').controller('AdminController', ['$http', '$scope', '$location', 'Authentication', '$timeout',
    function($http, $scope, $location, Authentication, $timeout) {
        var user = Authentication.user;
        if (!user)
            $location.path('/');
        else if (user.roles.indexOf('technician') < 0 && user.roles.indexOf('admin') < 0)
            $location.path('/');
        else if (user.roles.indexOf('admin') >= 0)
            $scope.isAdmin = true;

        $scope.popover = {
            templateUrl: 'popoverTemplate.html',
            adminPwd:''
        };

        $scope.verifyAdmin = function () {
            $scope.adminError = undefined;
            if (!$scope.adminVerified) {
                var pwd = $scope.popover.adminPwd;
                $http.post('/auth/authenticate', {password: <PASSWORD>})
                    .success(function () {
                        $scope.adminVerified = true;
                        $scope.popover.adminPwd = '';
                        $timeout(function(){ $scope.adminVerified = false;}, 20000);
                    })
                    .error(function (err) { $scope.adminError = err; });
            }
        };
    }
]);<commit_msg>Fixed minor bugs<commit_after>'use strict';

angular.module('admin').controller('AdminController', ['$http', '$scope', '$location', 'Authentication', '$timeout',
    function($http, $scope, $location, Authentication, $timeout) {
        var user = Authentication.user;
        if (!user)
            $location.path('/');
        else if (user.roles.indexOf('technician') < 0 && user.roles.indexOf('admin') < 0)
            $location.path('/');
        else if (user.roles.indexOf('admin') >= 0)
            $scope.isAdmin = true;

        $scope.popover = {
            templateUrl: 'popoverTemplate.html',
            adminPwd:''
        };

        $scope.verifyAdmin = function () {
            $scope.adminError = undefined;
            if (!$scope.adminVerified) {
                var pwd = $scope.popover.adminPwd;
                $http.post('/auth/authenticate', {password: pwd})
                    .success(function () {
                        $scope.adminVerified = true;
                        $scope.popover.adminPwd = <PASSWORD>;
                        $timeout(function(){ $scope.adminVerified = false;}, 20000);
                    })
                    .error(function (err) { $scope.adminError = err; });
            }
        };
    }
]);
{'fraction_non_alphanumeric': 0.15818759936406995, 'fraction_numerical': 0.006359300476947536, 'mean_word_length': 1.7568455640744798, 'pattern_counts': {'":': 0, '<': 9, '<?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': '7318850', 'n_tokens_mistral': 704, 'n_tokens_neox': 669, 'n_words': 123}