Email Regex

Where is the email regex script in cs-cart??

Hi!

Where is the email regex script in cs-cart??

In CS-Cart email is mainly checked at front-end:

js/core/src/core/Tygh/plugins/form_validator/index.js

        if (lbl.hasClass('cm-email')) {
            if (!$.is.email(elm.val()) && !$.is.blank(elm.val())) {
                _formMessage(_.tr('error_validator_email'), lbl);
                set_mark = true;
            }
        }

js/core/src/core/Tygh/core_methods.js

export const is = {
    email: function(email) {
        return /^([^@\s]+<?)([^@\s]*)@(([^@\.\s]+?)|([^@\s]+?\.[^@\s]+?))(>?)$/i.test(email) ? true : false;
    },

And from back-end:

app/functions/fn.common.php

function fn_validate_email($email, $show_error = false)
{
    $regex = '/^([^@\s]+<?)([^@\s]*)@(([^@\.\s]+?)|([^@\s]+?\.[^@\s]+?))(>?)$/';
if (strlen($email) < 320 && preg_match($regex, stripslashes($email))) {
    return true;
} elseif ($show_error) {
    fn_set_notification('E', __('error'), __('text_not_valid_email', array(
        '[email]' => $email,
    )));
}

return false;

}

Hope this helps.