mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 10:56:15 +08:00
FIX: ReplyByEmailAddressValidator should leverage EmailAddressValidator
Since we already have perfectly sensible logic for validating email addresses, let's leverage that and simplify the logic while we're at it. Emails with spaces are no longer permitted (why were they?)
This commit is contained in:
parent
3bf3b9a4a5
commit
a312b9ae88
|
@ -7,17 +7,14 @@ class ReplyByEmailAddressValidator
|
|||
|
||||
def valid_value?(val)
|
||||
return true if val.blank?
|
||||
return false if !val.include?("@")
|
||||
|
||||
value = val.dup
|
||||
value.strip!
|
||||
return false if !EmailAddressValidator.valid_value?(val)
|
||||
|
||||
if SiteSetting.find_related_post_with_key
|
||||
return false if !value.include?("%{reply_key}")
|
||||
value.sub!(/\+?%{reply_key}/, "")
|
||||
return false if !val.include?("%{reply_key}")
|
||||
val.sub(/\+?%{reply_key}/, "") != SiteSetting.notification_email
|
||||
else
|
||||
val != SiteSetting.notification_email
|
||||
end
|
||||
|
||||
value != SiteSetting.notification_email && !value.include?(" ")
|
||||
end
|
||||
|
||||
def error_message
|
||||
|
|
Loading…
Reference in New Issue
Block a user