-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(isEmail): email starting with double quotes (#2437)
fixes #2432
- Loading branch information
1 parent
542cfba
commit 283a6a5
Showing
2 changed files
with
9 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,11 +109,11 @@ export default function isEmail(str, options) { | |
|
||
if (options.domain_specific_validation && (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com')) { | ||
/* | ||
Previously we removed dots for gmail addresses before validating. | ||
This was removed because it allows `[email protected]` | ||
to be reported as valid, but it is not. | ||
Gmail only normalizes single dots, removing them from here is pointless, | ||
should be done in normalizeEmail | ||
Previously we removed dots for gmail addresses before validating. | ||
This was removed because it allows `[email protected]` | ||
to be reported as valid, but it is not. | ||
Gmail only normalizes single dots, removing them from here is pointless, | ||
should be done in normalizeEmail | ||
*/ | ||
user = user.toLowerCase(); | ||
|
||
|
@@ -166,7 +166,7 @@ export default function isEmail(str, options) { | |
if (user.search(new RegExp(`[${options.blacklisted_chars}]+`, 'g')) !== -1) return false; | ||
} | ||
|
||
if (user[0] === '"') { | ||
if (user[0] === '"' && user[user.length - 1] === '"') { | ||
user = user.slice(1, user.length - 1); | ||
return options.allow_utf8_local_part ? | ||
quotedEmailUserUtf8.test(user) : | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,9 @@ describe('Validators', () => { | |
'nbsp [email protected]', | ||
'nbsp_test@te st.com', | ||
'[email protected] m', | ||
'"[email protected]', | ||
'"foo"[email protected]', | ||
'foo"bar"@gmail.com', | ||
], | ||
}); | ||
}); | ||
|