validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

Email Validator issue for double quotes and special characters

Open code0emperor opened this issue 1 year ago • 6 comments

For the isEmail function, some emails like "example*."@gmail.com gets accepted due to the given below function

if(user[0] === '"' && user[user.length - 1] === '"') {
    user = user.slice(1, user.length - 1);
    return options.allow_utf8_local_part ?
      quotedEmailUserUtf8.test(user) :
      quotedEmailUser.test(user);
  }

For a valid mail, charaters like '*' and '.' should not be accepted, even when enclosed within double quotes (they should only allow some special characters and spaces). So I think the quotedEmailUserUtf8 regEx needs to be checked, but I am not sure.

code0emperor avatar Aug 09 '24 18:08 code0emperor

heyy!! i want to work on this issue can i start working on it ?

Vinayak-Nevge avatar Aug 12 '24 18:08 Vinayak-Nevge

Go ahead

code0emperor avatar Aug 13 '24 11:08 code0emperor

is anyone working on this ? If not , can I ?

mathewalexKerala avatar Aug 16 '24 14:08 mathewalexKerala

* and . are allowed in email addresses. If quoted, a . character is also allowed as the last character of the local part: https://en.wikipedia.org/wiki/Email_address#Local-part

To sum up: "example*."@gmail.com is a valid email address.

gshpychka avatar Aug 22 '24 13:08 gshpychka

hey @code0emperor allow me to fix this

mishrasushant101 avatar Oct 06 '24 15:10 mishrasushant101

hey @code0emperor allow me to fix this

this isn't a bug, though, the email address is valid. the library does have gmail-specific rules - set domain_specific_validation to true in the options to enable those.

gshpychka avatar Oct 07 '24 12:10 gshpychka

@code0emperor I want to work on this issue. Allow me to do it

vennelaeruvala avatar Nov 14 '24 14:11 vennelaeruvala

@code0emperor I want to work on this issue. Allow me to do it

Please see my comment above

gshpychka avatar Nov 14 '24 15:11 gshpychka

closing this issue in favor of https://en.wikipedia.org/wiki/Email_address#Local-part

rubiin avatar Nov 14 '24 16:11 rubiin