<commit_before>'use strict';



app.controller('total',function($scope,$resource,$window){
    $scope.test = 'Kuku';
    $scope.logout = function(){
        sessionStorage.userId = undefined;
        $window.location.href = '/';
    }
});





app.controller('home',function($scope,$resource,$window,$document, $location, $anchorScroll){
    $scope.authFace = function(url){
        $window.location.href = url;
    }

    $('#carousel_1').carousel({
        interval: 5000
    })
    $scope.registerUser = function(){
        $window.location.href = 'registerUser';
    }
    $scope.scrollTo = function(id) {
        $location.hash(id);
        $anchorScroll();
        $location.hash('');
    }
    $scope.login = function(){
        if(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test($scope.email)){
            var address = $resource('/loginLocal');
            var query = new address();
            query.email = $scope.email;
            query.pwd = $<PASSWORD>;
            query.$save(function(data){
                if(data._id){
                    sessionStorage.userId = data._id;
                    $window.location.href='/loggedUser'+data._id+'-local';
                }else{
                    $window.location.href = '/';
                }
            });
        }else{
            $window.location.href = '/';
        }
    }
});

app.controller('registerUser',function($scope,$resource,$compile,$upload,$window,$location,$anchorScroll){
    $('#carousel_reg').carousel({
        interval: 5000
    })
    $scope.scrollTo = function(id) {
        $location.hash(id);
        $anchorScroll();
        $location.hash('');
    }
    //necessary
    $( "#datepicker" ).datepicker({
        changeMonth: true,
        changeYear: true,
        dateFormat: 'dd/mm/yy',
        yearRange: "1920:2014",
        onClose:function(){
            $scope.checkDateFormat();
        }
    });

    $scope.dateOfBirthPlaceholder = 'Enter date of birth format 00/00/0000 (day/month/year)';
    $scope.emailPlaceholder = 'Enter here your email address!';
    $scope.namePlaceholder = 'Your name goes here!';
    $scope.secondNamePlaceholder = 'Your second name goes here!';
    $scope.placeOfBirthPlaceholder = 'Enter country and city or town!';
    $scope.languagesPlaceholder = 'Languages goes here!';
    $scope.advance = 'false';

    $scope.checkTotal = function(){
        $scope.checkDateFormat();
        $scope.checkLanguagesInput();
        $scope.checkPlaceOfBirthInput();
        $scope.checkNameInput();
        $scope.checkSecondNameInput();
        $scope.checkEmailFormat();
        $scope.checkPwd();
        $scope.checkGender();
    }

    $scope.checkGender = function(){
        if(!$scope.gender){
            $scope.genderPlaceholder = 'Please check your gender! It is necessary!';
            $scope.genderError = true;
        }
    }

    $scope.checkLanguagesInput = function(){
        if($scope.selectedLanguages.length==0){
            $scope.selectedLanguagesError = true;
            $scope.languagesPlaceholder = 'This field is necessary';
        }else{
            $scope.selectedLanguagesError = false;
        }
    }

    $scope.checkPwd = function(){
        if(!$scope.passwordR){
            $scope.resPwd = 'Type in your new password!!!';
            $scope.pwdError = true;
        }else{
            $scope.confirmPassword();
        }
    }

    $scope.confirmPassword = function(){
        if($scope.password!=$scope.passwordR){
            $scope.pwdError = true;
            $scope.resPwd = 'You have entered wrong confirmation password!';
        }else{
            $scope.resPwd = 'Confirmation is done!';
        }
    }

    $scope.focusPassword = function(){
        $scope.resPwd = undefined;
        $scope.passwordR = undefined;
        $scope.pwdError = undefined;
    }

    $scope.checkPlaceOfBirthInput = function(){
        if($scope.placeOfBirth===undefined || $scope.placeOfBirth==''){
            $scope.placeOfBirthInputError = true;
            $scope.placeOfBirthPlaceholder = 'This field is necessary!!!';
        }else{
            $scope.placeOfBirthInputError = false;
        }
    }

    $scope.refreshPlaceOfBirth = function(){
        $scope.placeOfBirth = undefined;
        $scope.placeOfBirthInputError = false;
    }

    $scope.checkNameInput = function(){
        if($scope.name===undefined || $scope.name==''){
            $scope.nameInputError = true;
            $scope.namePlaceholder = 'This field is necessary!!!';
        }else{
            $scope.nameInputError = false;
        }
    }

    $scope.refreshFirstName = function(){
        $scope.name = undefined;
        $scope.nameInputError = false;
    }

    $scope.checkSecondNameInput = function(){
        if($scope.secondName===undefined || $scope.secondName==''){
            $scope.secondNameInputError = true;
            $scope.secondNamePlaceholder = 'This field is necessary!!!';
        }else{
            $scope.secondNameInputError = false;
        }
    }

    $scope.refreshLastName = function(){
        $scope.secondName = undefined;
        $scope.secondNameInputError = false;
    }

    $scope.dateRes = undefined;
    $scope.checkDateFormat = function(){
        if(!/^\d{1,2}\/\d{1,2}\/\d{4}$/.test($scope.dateOfBirth)){
            $scope.dateRes = 'Hura';
        }else{
            $scope.dateRes = 'Fuck';
        }
    }

    $scope.checkEmailFormat = function(){
        if($scope.email===undefined || $scope.email==''){
            $scope.emailError = true;
            $scope.emailPlaceholder = 'Register an email address!';
        }else if(!/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test($scope.email)){
            $scope.email = '';
            $scope.emailError = true;
            $scope.emailPlaceholder = 'Wrong email format!';
        }else{
            $scope.emailError = false;
            var address = $resource('/checkEmailExist/'+$scope.email);<commit_msg>dateNew<commit_after>'use strict';



app.controller('total',function($scope,$resource,$window){
    $scope.test = 'Kuku';
    $scope.logout = function(){
        sessionStorage.userId = undefined;
        $window.location.href = '/';
    }
});





app.controller('home',function($scope,$resource,$window,$document, $location, $anchorScroll){
    $scope.authFace = function(url){
        $window.location.href = url;
    }

    $('#carousel_1').carousel({
        interval: 5000
    })
    $scope.registerUser = function(){
        $window.location.href = 'registerUser';
    }
    $scope.scrollTo = function(id) {
        $location.hash(id);
        $anchorScroll();
        $location.hash('');
    }
    $scope.login = function(){
        if(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test($scope.email)){
            var address = $resource('/loginLocal');
            var query = new address();
            query.email = $scope.email;
            query.pwd = $<PASSWORD>;
            query.$save(function(data){
                if(data._id){
                    sessionStorage.userId = data._id;
                    $window.location.href='/loggedUser'+data._id+'-local';
                }else{
                    $window.location.href = '/';
                }
            });
        }else{
            $window.location.href = '/';
        }
    }
});

app.controller('registerUser',function($scope,$resource,$compile,$upload,$window,$location,$anchorScroll){
    $('#carousel_reg').carousel({
        interval: 5000
    })
    $scope.scrollTo = function(id) {
        $location.hash(id);
        $anchorScroll();
        $location.hash('');
    }
    //necessary
    $( "#datepicker" ).datepicker({
        changeMonth: true,
        changeYear: true,
        dateFormat: 'dd/mm/yy',
        yearRange: "1920:2014",
        onClose:function(){
            $scope.checkDateFormat();
        }
    });

    $scope.dateOfBirthPlaceholder = 'Enter date of birth format 00/00/0000 (day/month/year)';
    $scope.emailPlaceholder = 'Enter here your email address!';
    $scope.namePlaceholder = 'Your name goes here!';
    $scope.secondNamePlaceholder = 'Your second name goes here!';
    $scope.placeOfBirthPlaceholder = 'Enter country and city or town!';
    $scope.languagesPlaceholder = 'Languages goes here!';
    $scope.advance = 'false';

    $scope.checkTotal = function(){
        $scope.checkDateFormat();
        $scope.checkLanguagesInput();
        $scope.checkPlaceOfBirthInput();
        $scope.checkNameInput();
        $scope.checkSecondNameInput();
        $scope.checkEmailFormat();
        $scope.checkPwd();
        $scope.checkGender();
    }

    $scope.checkGender = function(){
        if(!$scope.gender){
            $scope.genderPlaceholder = 'Please check your gender! It is necessary!';
            $scope.genderError = true;
        }
    }

    $scope.checkLanguagesInput = function(){
        if($scope.selectedLanguages.length==0){
            $scope.selectedLanguagesError = true;
            $scope.languagesPlaceholder = 'This field is necessary';
        }else{
            $scope.selectedLanguagesError = false;
        }
    }

    $scope.checkPwd = function(){
        if(!$scope.passwordR){
            $scope.resPwd = 'Type in your new password!!!';
            $scope.pwdError = true;
        }else{
            $scope.confirmPassword();
        }
    }

    $scope.confirmPassword = function(){
        if($scope.password!=$scope.passwordR){
            $scope.pwdError = true;
            $scope.resPwd = 'You have entered wrong confirmation password!';
        }else{
            $scope.resPwd = '<PASSWORD>!';
        }
    }

    $scope.focusPassword = function(){
        $scope.resPwd = <PASSWORD>;
        $scope.passwordR = <PASSWORD>;
        $scope.pwdError = undefined;
    }

    $scope.checkPlaceOfBirthInput = function(){
        if($scope.placeOfBirth===undefined || $scope.placeOfBirth==''){
            $scope.placeOfBirthInputError = true;
            $scope.placeOfBirthPlaceholder = 'This field is necessary!!!';
        }else{
            $scope.placeOfBirthInputError = false;
        }
    }

    $scope.refreshPlaceOfBirth = function(){
        $scope.placeOfBirth = undefined;
        $scope.placeOfBirthInputError = false;
    }

    $scope.checkNameInput = function(){
        if($scope.name===undefined || $scope.name==''){
            $scope.nameInputError = true;
            $scope.namePlaceholder = 'This field is necessary!!!';
        }else{
            $scope.nameInputError = false;
        }
    }

    $scope.refreshFirstName = function(){
        $scope.name = undefined;
        $scope.nameInputError = false;
    }

    $scope.checkSecondNameInput = function(){
        if($scope.secondName===undefined || $scope.secondName==''){
            $scope.secondNameInputError = true;
            $scope.secondNamePlaceholder = 'This field is necessary!!!';
        }else{
            $scope.secondNameInputError = false;
        }
    }

    $scope.refreshLastName = function(){
        $scope.secondName = undefined;
        $scope.secondNameInputError = false;
    }


    $scope.checkDateFormat = function(){
        $scope.dateRes = undefined;
        if(!/^\d{1,2}\/\d{1,2}\/\d{4}$/.test($scope.dateOfBirth)){
            $scope.dateRes = 'Hura';
        }else{
            $scope.dateRes = 'Fuck';
        }
    }

    $scope.checkEmailFormat = function(){
        if($scope.email===undefined || $scope.email==''){
            $scope.emailError = true;
            $scope.emailPlaceholder = 'Register an email address!';
        }else if(!/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test($scope.email)){
            $scope.email = '';
            $scope.emailError = true;
            $scope.emailPlaceholder = 'Wrong email format!';
        }else{
            $scope.emailError = false;
            var address = $resource('/checkEmailExist/'+$scope.email);
{'fraction_non_alphanumeric': 0.1820980153908465, 'fraction_numerical': 0.01117861482381531, 'mean_word_length': 2.1688911704312117, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '3590344', 'n_tokens_mistral': 3874, 'n_tokens_neox': 3740, 'n_words': 561}