mirror of
https://github.com/discourse/discourse.git
synced 2025-08-20 18:52:44 +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
1 changed files with 5 additions and 8 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue