Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 2360 email validation #2384

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/isDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function zip(date, format) {
}

export default function isDate(input, options) {
if (typeof options === 'string') { // Allow backward compatbility for old format isDate(input [, format])
if (typeof options === 'string') { // Allow backward compatibility for old format isDate(input [, format])
options = merge({ format: options }, default_date_options);
} else {
options = merge(options, default_date_options);
Expand Down
3 changes: 2 additions & 1 deletion src/lib/isEmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const default_email_options = {
/* eslint-disable max-len */
/* eslint-disable no-control-regex */
const splitNameAddress = /^([^\x00-\x1F\x7F-\x9F\cX]+)</i;
const emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i;
// Updated regular expression pattern for email user part validation
const emailUserPart = /^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~\-]+(\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~\-]+)*$/;
Comment on lines +23 to +24
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bigger change than I expected, why is that? What is the source of this new RegEx pattern?

Also; the comment is not needed here

const gmailUserPart = /^[a-z\d]+$/;
const quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i;
const emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
Expand Down