emails: disallow names ending with a period.

Update email validation rules to disallow the percent character (e.g.
`foo%bar@gmail.com`) and names ending with a period (e.g. `foo.@gmail.com`).
Names ending with a period are invalid according to the RFCs and cause
`Mail::Address.new` to raise an exception.

The percent character is technically legal, but only one email used it
and it was probably a typo.
This commit is contained in:
evazion
2022-10-17 21:32:27 -05:00
parent e31977ac29
commit 873c67db58
3 changed files with 8 additions and 3 deletions

View File

@@ -51,6 +51,7 @@ class EmailAddressTest < ActiveSupport::TestCase
assert_equal("foo@gmail.com", EmailAddress.new(address: "foo@g,ail.com").address.to_s)
assert_equal("foo@gmail.com", EmailAddress.new(address: "foo@gmai;.com").address.to_s)
assert_equal("foo@gmail.com", EmailAddress.new(address: "foo@gmail@com").address.to_s)
assert_equal("foo@gmail.com", EmailAddress.new(address: "foo.@gmail.com").address.to_s)
end
end
end