Defect #36969 » 36969.patch
app/models/email_address.rb | ||
---|---|---|
20 | 20 |
class EmailAddress < ActiveRecord::Base |
21 | 21 |
include Redmine::SafeAttributes |
22 | 22 | |
23 |
EMAIL_REGEXP = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+(?:(?:xn--[-a-z0-9]+)|(?:[a-z]{2,})))\z/i |
|
24 | ||
25 | 23 |
belongs_to :user |
26 | 24 | |
27 | 25 |
after_update :destroy_tokens |
... | ... | |
32 | 30 |
after_destroy_commit :deliver_security_notification_destroy |
33 | 31 | |
34 | 32 |
validates_presence_of :address |
35 |
validates_format_of :address, :with => EMAIL_REGEXP, :allow_blank => true |
|
33 |
validates_format_of :address, :with => URI::MailTo::EMAIL_REGEXP, :allow_blank => true
|
|
36 | 34 |
validates_length_of :address, :maximum => User::MAIL_LENGTH_LIMIT, :allow_nil => true |
37 | 35 |
validates_uniqueness_of :address, :case_sensitive => false, |
38 | 36 |
:if => Proc.new {|email| email.address_changed? && email.address.present?} |
app/models/setting.rb | ||
---|---|---|
188 | 188 |
if settings.key?(:mail_from) |
189 | 189 |
begin |
190 | 190 |
mail_from = Mail::Address.new(settings[:mail_from]) |
191 |
raise unless EmailAddress::EMAIL_REGEXP.match?(mail_from.address)
|
|
191 |
raise unless URI::MailTo::EMAIL_REGEXP.match?(mail_from.address)
|
|
192 | 192 |
rescue |
193 | 193 |
messages << [:mail_from, l('activerecord.errors.messages.invalid')] |
194 | 194 |
end |