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

Improve IP blocking error message

This commit is contained in:
Arpit Jalan 2015-06-02 07:35:42 +05:30
parent 9dd6b65e88
commit b7ac8448c6
3 changed files with 3 additions and 2 deletions

View file

@ -5,7 +5,7 @@ class AllowedIpAddressValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
if record.ip_address
if ScreenedIpAddress.should_block?(record.ip_address)
record.errors.add(attribute, options[:message] || I18n.t('user.ip_address.blocked'))
record.errors.add(attribute, I18n.t('user.ip_address.blocked'))
end
if record.trust_level == TrustLevel[0] && SpamHandler.should_prevent_registration_from_ip?(record.ip_address)
record.errors.add(attribute, I18n.t('user.ip_address.max_new_accounts_per_registration_ip'))