<commit_before>AT.prototype.atPwdFormHelpers = {
    disabled: function() {
        return AccountsTemplates.isDisabled() ? 'disabled' : '';
    },
    fields: function() {
        var parentData = UI._parentData(1);
        var state = (parentData && parentData.state) || AccountsTemplates.getState();
        return _.filter(AccountsTemplates.getFields(), function(s) {
            return _.contains(s.visible, state);
        });
    },
    showForgotPasswordLink: function() {
        var parentData = UI._parentData(1);
        var state = (parentData && parentData.state) || AccountsTemplates.getState();
        return state === 'signIn' && AccountsTemplates.getConfig('showForgotPasswordLink');
    },
};

AT.prototype.atPwdFormEvents = {
    // Form submit
    'submit #at-pwd-form': function(event, t) {
        event.preventDefault();
        $("#at-btn").blur();

        // Clears error and result
        AccountsTemplates.clearFieldErrors();
        AccountsTemplates.setDisabled(true);

        var state = this.state || AccountsTemplates.getState();

        // Client-side pre-validation
        // Validates fields values
        // NOTE: This is the only place where password validation can be enforced!
        var formData = {};
        var someError = false;
        var errList = [];
        _.each(AccountsTemplates.getFields(), function(field){
            // Considers only visible fields...
            if (!_.contains(field.visible, state))
                return;

            var fieldId = field._id;
            var inputField = t.find('#AT_field_' + fieldId);
            var value = inputField.value || '';

            // Possibly applies required transformations to the input value
            var newValue = value;
            if (field.trim)
                newValue = newValue.trim();
            if (field.lowercase)
                newValue = newValue.toLowerCase();
            if (field.uppercase)
                newValue = newValue.toUpperCase();
            // Possibly updates the input value
            if (newValue !== value){
                value = newValue;
                inputField.value = value;
            }

            if (value)
                formData[fieldId] = value;

            // Validates the field value
            var validationErr = AccountsTemplates.validateField(fieldId, value, 'strict');
            if (validationErr) {
                AccountsTemplates.setFieldError(fieldId, validationErr);
                if (!field.negativeValidation){
                    var fId = T9n.get(field.displayName, markIfMissing=false);
                    var err = T9n.get('error.accounts.' + validationErr, markIfMissing=false);
                    // Possibly removes initial prefix in case the key in not found inside t9n
                    if (err.substring(0, 15) === 'error.accounts.')
                        err = err.substring(15);
                    errList.push(fId + ': ' + err);
                }
                someError = true;
            }
        });
        if (someError){<commit_msg>fixed unwanted validation discovered thanks to #80<commit_after>AT.prototype.atPwdFormHelpers = {
    disabled: function() {
        return AccountsTemplates.isDisabled() ? 'disabled' : '';
    },
    fields: function() {
        var parentData = UI._parentData(1);
        var state = (parentData && parentData.state) || AccountsTemplates.getState();
        return _.filter(AccountsTemplates.getFields(), function(s) {
            return _.contains(s.visible, state);
        });
    },
    showForgotPasswordLink: function() {
        var parentData = UI._parentData(1);
        var state = (parentData && parentData.state) || AccountsTemplates.getState();
        return state === 'signIn' && AccountsTemplates.getConfig('showForgotPasswordLink');
    },
};

AT.prototype.atPwdFormEvents = {
    // Form submit
    'submit #at-pwd-form': function(event, t) {
        event.preventDefault();
        $("#at-btn").blur();

        // Clears error and result
        AccountsTemplates.clearFieldErrors();
        AccountsTemplates.setDisabled(true);

        var state = this.state || AccountsTemplates.getState();
        var preValidation = (state !== "signIn");

        // Client-side pre-validation
        // Validates fields values
        // NOTE: This is the only place where password validation can be enforced!
        var formData = {};
        var someError = false;
        var errList = [];
        _.each(AccountsTemplates.getFields(), function(field){
            // Considers only visible fields...
            if (!_.contains(field.visible, state))
                return;

            var fieldId = field._id;
            var inputField = t.find('#AT_field_' + fieldId);
            var value = inputField.value || '';

            // Possibly applies required transformations to the input value
            var newValue = value;
            if (field.trim)
                newValue = newValue.trim();
            if (field.lowercase)
                newValue = newValue.toLowerCase();
            if (field.uppercase)
                newValue = newValue.toUpperCase();
            // Possibly updates the input value
            if (newValue !== value){
                value = newValue;
                inputField.value = value;
            }

            if (value)
                formData[fieldId] = value;

            // Validates the field value only if current state is not "signIn"
            if (preValidation){
                var validationErr = AccountsTemplates.validateField(fieldId, value, 'strict');
                if (validationErr) {
                    AccountsTemplates.setFieldError(fieldId, validationErr);
                    if (!field.negativeValidation){
                        var fId = T9n.get(field.displayName, markIfMissing=false);
                        var err = T9n.get('error.accounts.' + validationErr, markIfMissing=false);
                        // Possibly removes initial prefix in case the key in not found inside t9n
                        if (err.substring(0, 15) === 'error.accounts.')
                            err = err.substring(15);
                        errList.push(fId + ': ' + err);
                    }
                    someError = true;
                }
            }
        });
        if (someError){
{'fraction_non_alphanumeric': 0.11057012721847023, 'fraction_numerical': 0.0034553164755771948, 'mean_word_length': 1.786870897155361, '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': '6156222', 'n_tokens_mistral': 1658, 'n_tokens_neox': 1597, 'n_words': 392}