Merge commit from fork

* Disallow some special characters in e-mail addresses

* Add size limit to email columns
This commit is contained in:
Claire authored and GitHub committed 2026-04-15 15:22:33 +02:00
1 parent fab1e799a6
commit d6f62f5fa4
3 files changed
+9 -3

No files matched your search

+7 -1
View File
@@ -11,8 +11,14 @@ class EmailAddressValidator < ActiveModel::EachValidator
value = value.strip
address = Mail::Address.new(value)
record.errors.add(attribute, :invalid) if address.address != value
record.errors.add(attribute, :invalid) if address.address != value || contains_disallowed_characters?(value)
rescue Mail::Field::FieldError
record.errors.add(attribute, :invalid)
end
private
def contains_disallowed_characters?(value)
value.include?('%') || value.include?(',') || value.include?('"')
end
end