Skip to content

Commit

Permalink
fix(isEmail): replace all dots in gmail length validation (#1718)
Browse files Browse the repository at this point in the history
  • Loading branch information
DasDingGehtNicht committed Sep 26, 2021
1 parent b069167 commit a3497bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/isEmail.js
Expand Up @@ -110,7 +110,7 @@ export default function isEmail(str, options) {
const username = user.split('+')[0];

// Dots are not included in gmail length restriction
if (!isByteLength(username.replace('.', ''), { min: 6, max: 30 })) {
if (!isByteLength(username.replace(/\./g, ''), { min: 6, max: 30 })) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion test/validators.js
Expand Up @@ -70,7 +70,7 @@ describe('Validators', () => {
'hans@m端ller.com',
'test|123@m端ller.com',
'test123+ext@gmail.com',
'some.name.midd.leNa.me+extension@GoogleMail.com',
'some.name.midd.leNa.me.and.locality+extension@GoogleMail.com',
'"foobar"@example.com',
'" foo m端ller "@example.com',
'"foo\\@bar"@example.com',
Expand Down

0 comments on commit a3497bd

Please sign in to comment.