From 89f02c2ba3b252c0de2e3eda074200835974046a Mon Sep 17 00:00:00 2001 From: Dustin Date: Mon, 30 Aug 2021 16:27:19 +0200 Subject: [PATCH] fix(isEmail): replace all dots in gmail length validation --- src/lib/isEmail.js | 2 +- test/validators.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/isEmail.js b/src/lib/isEmail.js index ecbd398c9..8f1dcd98a 100644 --- a/src/lib/isEmail.js +++ b/src/lib/isEmail.js @@ -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; } diff --git a/test/validators.js b/test/validators.js index 6bb607282..186d7a215 100644 --- a/test/validators.js +++ b/test/validators.js @@ -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',