2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-07 12:02:53 +08:00

FIX: don't allow spaces in 'reply_by_email_address' site setting

This commit is contained in:
Régis Hanol 2018-04-17 17:08:12 +02:00
parent ad4c25e004
commit 2585ada5ca
2 changed files with 10 additions and 4 deletions

View file

@ -4,14 +4,19 @@ class ReplyByEmailAddressValidator
end
def valid_value?(val)
val&.strip!
return true if val.blank?
return false if val["@"].nil?
return false if !val.include?("@")
value = val.dup
if SiteSetting.find_related_post_with_key
!!val["%{reply_key}"] && val.sub(/\+?%{reply_key}/, "") != SiteSetting.notification_email
else
val != SiteSetting.notification_email
return false if !value.include?("%{reply_key}")
value.sub!(/\+?%{reply_key}/, "")
end
value != SiteSetting.notification_email && !value.include?(" ")
end
def error_message