Skip to content

Commit

Permalink
Merge pull request #1163 from pmcmaw/test_emails
Browse files Browse the repository at this point in the history
(bugfix) Setting stricter email validation
  • Loading branch information
DavidS authored Feb 10, 2021
2 parents 3b5f268 + 5b2a2a3 commit 3373a08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions spec/type_aliases/email_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
'email@example.com (Joe Smith)',
'email@-example.com',
'email@example..com',
'random stuff multiline
valid@email.com
more random stuff $^*!',
'”(),:;<>[\]@example.com',
'just”not”right@example.com',
'this\ is"really"not\allowed@example.com'].each do |value|
Expand Down
2 changes: 1 addition & 1 deletion types/email.pp
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
type Stdlib::Email = Pattern[/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/]
type Stdlib::Email = Pattern[/\A[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\z/]

0 comments on commit 3373a08

Please sign in to comment.