mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
Add screening by IP address. When deleting a user as a spammer, block all signups from the same IP address.
This commit is contained in:
9
lib/validators/allowed_ip_address_validator.rb
Normal file
9
lib/validators/allowed_ip_address_validator.rb
Normal file
@ -0,0 +1,9 @@
|
||||
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
|
Reference in New Issue
Block a user