<commit_before>var app = angular.module("generatePassword", ['ngCookies']);
app.controller("IndexCtrl", function($scope, $timeout, $cookies, generatePassword) {

    $scope.newPassword = <PASSWORD>;
    $scope.settingsActive = false;
    $scope.showConvince = false;

    $scope.length = 16;
    $scope.pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/.?,;:!*$=+}])@_-[({\'"#~&<>';
    $scope.similarCharacters = 'iIL1o0O';
    $scope.excludeSimilars = true;

    $scope.save = false;
    $scope.startRefreshing = false;

    var cookies = $cookies.getAll();
    //console.log(cookies);

    if (cookies.length) {
        $scope.length = parseInt(cookies.length);
    }

    if (cookies.pool) {
        $scope.pool = cookies.pool;
    }

    if (cookies['similar-characters']) {
        $scope.similarCharacters = cookies['similar-characters'];
    }

    if (cookies['exclude-similars']) {
        $scope.excludeSimilars = (cookies['exclude-similars'] == "true");
    }

    if (cookies.save) {
        $scope.save = (cookies.save == "true");
    }

    $scope.refresh = function (callback) {
        if ($scope.startRefreshing) {
            $scope.refreshing = true;
            $timeout(function () {
                $scope.refreshing = false;
            }, 1000);
        }
        $scope.newPassword = generatePassword({
            length: $scope.length,
            pool: $scope.pool,
            exclude_similars: $scope.excludeSimilars,
            to_exclude: $scope.similarCharacters
        });

        callback && callback();
    };

    $scope.refresh(function () {
        $scope.startRefreshing = true;

        $scope.$watch('length', function () {
            if ($scope.save) {
                $cookies.put('length', $scope.length);
            }
            $scope.refresh();
        });

        $scope.$watch('pool', function () {
            if ($scope.save) {
                $cookies.put('pool', $scope.pool);
            }
            $scope.refresh();
        });

        $scope.$watch('similarCharacters', function () {
            if ($scope.save) {
                $cookies.put('similar-characters', $scope.similarCharacters);
            }
            $scope.refresh();
        });

        $scope.$watch('excludeSimilars', function () {
            if ($scope.save) {
                $cookies.put('exclude-similars', $scope.excludeSimilars);
                var cookies = $cookies.getAll();
                //console.log(cookies);
            }
            $scope.refresh();
        });

        $scope.$watch('save', function () {
            if ($scope.save) {
                $cookies.put('length', $scope.length);
                $cookies.put('pool', $scope.pool);
                $cookies.put('similar-characters', $scope.similarCharacters);
                $cookies.put('exclude-similars', $scope.excludeSimilars);
                $cookies.put('save', $scope.save);

                var cookies = $cookies.getAll();
                //console.log(cookies);
            } else {
                $cookies.remove('length');
                $cookies.remove('pool');
                $cookies.remove('similar-characters');
                $cookies.remove('exclude-similars');
                $cookies.remove('save');
            }
        });
    });

    $scope.toggleSettings = function ($event) {
        console.log('toggle');
        $scope.settingsActive = !$scope.settingsActive;
        $event.preventDefault();
        $event.stopPropagation();
    };

    $scope.hideSettings = function ($event) {
        console.log('hide');
        $scope.settingsActive = false;
        $event.preventDefault();
        $event.stopPropagation();
    };

    $scope.convince = function ($event) {
        console.log($scope.showConvince);<commit_msg>add numbers in pool and change the date of expiration of cookies<commit_after>var app = angular.module("generatePassword", ['ngCookies']);
app.controller("IndexCtrl", function($scope, $timeout, $cookies, generatePassword) {

    $scope.newPassword = <PASSWORD>;
    $scope.settingsActive = false;
    $scope.showConvince = false;

    $scope.length = 16;
    $scope.pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/.?,;:!*$=+}])@_-[({\'"#~&<>0123456789';
    $scope.similarCharacters = 'iIL1o0O';
    $scope.excludeSimilars = true;

    $scope.save = false;
    $scope.startRefreshing = false;

    var cookies = $cookies.getAll();
    //console.log(cookies);

    if (cookies.length) {
        $scope.length = parseInt(cookies.length);
    }

    if (cookies.pool) {
        $scope.pool = cookies.pool;
    }

    if (cookies['similar-characters']) {
        $scope.similarCharacters = cookies['similar-characters'];
    }

    if (cookies['exclude-similars']) {
        $scope.excludeSimilars = (cookies['exclude-similars'] == "true");
    }

    if (cookies.save) {
        $scope.save = (cookies.save == "true");
    }

    $scope.refresh = function (callback) {
        if ($scope.startRefreshing) {
            $scope.refreshing = true;
            $timeout(function () {
                $scope.refreshing = false;
            }, 1000);
        }
        $scope.newPassword = generatePassword({
            length: $scope.length,
            pool: $scope.pool,
            exclude_similars: $scope.excludeSimilars,
            to_exclude: $scope.similarCharacters
        });

        callback && callback();
    };

    $scope.refresh(function () {
        $scope.startRefreshing = true;

        $scope.$watch('length', function () {
            if ($scope.save) {
                $cookies.put('length', $scope.length,{'expires': (new Date() + 365)}  );
            }
            $scope.refresh();
        });

        $scope.$watch('pool', function () {
            if ($scope.save) {
                $cookies.put('pool', $scope.pool, {'expires': (new date() + 365)});
            }
            $scope.refresh();
        });

        $scope.$watch('similarCharacters', function () {
            if ($scope.save) {
                $cookies.put('similar-characters', $scope.similarCharacters,{'expires': (new Date() + 365)});
            }
            $scope.refresh();
        });

        $scope.$watch('excludeSimilars', function () {
            if ($scope.save) {
                $cookies.put('exclude-similars', $scope.excludeSimilars,{'expires': (new Date() + 365)});
                var cookies = $cookies.getAll();
                //console.log(cookies);
            }
            $scope.refresh();
        });

        $scope.$watch('save', function () {
            if ($scope.save) {
                $cookies.put('length', $scope.length,{'expires': (new Date() + 365)});
                $cookies.put('pool', $scope.pool,{'expires': (new Date() + 365)});
                $cookies.put('similar-characters', $scope.similarCharacters,{'expires': (new Date() + 365)});
                $cookies.put('exclude-similars', $scope.excludeSimilars,{'expires': (new Date() + 365)});
                $cookies.put('save', $scope.save);

                var cookies = $cookies.getAll();
                //console.log(cookies);
            } else {
                $cookies.remove('length');
                $cookies.remove('pool');
                $cookies.remove('similar-characters');
                $cookies.remove('exclude-similars');
                $cookies.remove('save');
            }
        });
    });

    $scope.toggleSettings = function ($event) {
        console.log('toggle');
        $scope.settingsActive = !$scope.settingsActive;
        $event.preventDefault();
        $event.stopPropagation();
    };

    $scope.hideSettings = function ($event) {
        console.log('hide');
        $scope.settingsActive = false;
        $event.preventDefault();
        $event.stopPropagation();
    };

    $scope.convince = function ($event) {
        console.log($scope.showConvince);
{'fraction_non_alphanumeric': 0.16493802175562863, 'fraction_numerical': 0.006324310650139135, 'mean_word_length': 1.9916761256148316, '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': '863055', 'n_tokens_mistral': 2462, 'n_tokens_neox': 2291, 'n_words': 345}