mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
9 lines
No EOL
297 B
Ruby
9 lines
No EOL
297 B
Ruby
class AllowedIpAddressValidator < ActiveModel::EachValidator
|
|
|
|
def validate_each(record, attribute, value)
|
|
if record.ip_address and ScreenedIpAddress.should_block?(record.ip_address)
|
|
record.errors.add(attribute, options[:message] || I18n.t('user.ip_address.blocked'))
|
|
end
|
|
end
|
|
|
|
end |