<commit_before>/*!*
 * Basic rules for jquery.form2
 * Copyright (c) 2014 <NAME>
 *
 * @license https://github.com/bobkhin/jquery.form2/blob/master/LICENSE
 *
 * Date: Mon, May 19th, 2014 (GTM+7)
 */
(function ($) {
    var form2 = $.form2;

    form2.addRule('required', {
        validate: function (control, value, options, groupType) {
            if (groupType) {
                return value.length > 0;
            } else {
                return !!value;
            }
        },
        message: function (control, controlName, options, groupType) {
            if (groupType) {
                if (groupType === 'radio') {
                    return form2.formatString('Please select {0}', controlName);
                } else {
                    return form2.formatString('Please select at least one of {0}', controlName);
                }
            } else {
                return controlName + ' must be not blank';
            }

        }
    });

    form2.addRule('password', {
        validate: function (control, value, options, groupType) {
            var regex = form2.generatePasswordRegex(options.password);

            return !!value && regex.test(value);
        },
        message: function (control, controlName, options, groupType) {
            return form2.formatString('{0} {1}', controlName, options.password.errorMessage);
        }
    });

    form2.addRule('repassword', {
        validate: function (control, value, options, groupType) {
            var txtPassword = control.closest('form').find(':password').not(control);
            var password = txtPassword.val();
            var isRequiredIf = txtPassword.is('[data-required-if=true]');
            
            if (isRequiredIf) {
                if (password) {
                    return !!value && value === password;
                } else {
                    return true;
                }
            } else {<commit_msg>Fix bug repassword when password is requiredIf<commit_after>/*!*
 * Basic rules for jquery.form2
 * Copyright (c) 2014 <NAME>
 *
 * @license https://github.com/bobkhin/jquery.form2/blob/master/LICENSE
 *
 * Date: Mon, May 19th, 2014 (GTM+7)
 */
(function ($) {
    var form2 = $.form2;

    form2.addRule('required', {
        validate: function (control, value, options, groupType) {
            if (groupType) {
                return value.length > 0;
            } else {
                return !!value;
            }
        },
        message: function (control, controlName, options, groupType) {
            if (groupType) {
                if (groupType === 'radio') {
                    return form2.formatString('Please select {0}', controlName);
                } else {
                    return form2.formatString('Please select at least one of {0}', controlName);
                }
            } else {
                return controlName + ' must be not blank';
            }

        }
    });

    form2.addRule('password', {
        validate: function (control, value, options, groupType) {
            var regex = form2.generatePasswordRegex(options.password);

            return !!value && regex.test(value);
        },
        message: function (control, controlName, options, groupType) {
            return form2.formatString('{0} {1}', controlName, options.password.errorMessage);
        }
    });

    form2.addRule('repassword', {
        validate: function (control, value, options, groupType) {
            var txtPassword = control.closest('form').find(':password').not(control);
            var password = txtPassword.val();
            var isRequiredIf = txtPassword.is('[data-form2$=requiredIf]');
            
            if (isRequiredIf) {
                if (password) {
                    return !!value && value === password;
                } else {
                    return true;
                }
            } else {
{'fraction_non_alphanumeric': 0.12474332648870637, 'fraction_numerical': 0.014117043121149897, 'mean_word_length': 1.698753462603878, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '939744', 'n_tokens_mistral': 1063, 'n_tokens_neox': 1007, 'n_words': 248}