Skip to content

Commit

Permalink
Merge pull request #146 from UKHomeOffice/update-email-regex
Browse files Browse the repository at this point in the history
Update email regex to exclude some invalid hostnames
  • Loading branch information
HughePaul authored Nov 28, 2019
2 parents 220e86b + 5bf927d commit 6f6ac9e
Show file tree
Hide file tree
Showing 5 changed files with 394 additions and 407 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: node_js
node_js:
- "6"
- "8"
- "10"
- "12"
notifications:
email: false
sudo: false
2 changes: 1 addition & 1 deletion lib/validation/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let validators = {
},

email(value) {
return value === '' || validators.regex(value, /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,6}$/i);
return value === '' || validators.regex(value, /^[a-z0-9._%+-]+@([a-z0-9]+([a-z0-9-]*[a-z0-9]+)?\.)+[a-z]{2,6}$/i);
},

minlength(value, length) {
Expand Down
Loading

0 comments on commit 6f6ac9e

Please sign in to comment.