2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-10 21:01:33 +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:
Neil Lalonde 2013-10-21 14:49:51 -04:00
parent e527cbf884
commit 648b11a0eb
29 changed files with 455 additions and 12 deletions

View file

@ -226,7 +226,6 @@ describe User do
end
end
context 'after_save' do
before do
subject.save
@ -238,6 +237,21 @@ describe User do
end
end
describe 'ip address validation' do
it 'validates ip_address for new users' do
u = Fabricate.build(:user)
AllowedIpAddressValidator.any_instance.expects(:validate_each).with(u, :ip_address, u.ip_address)
u.valid?
end
it 'does not validate ip_address when updating an existing user' do
u = Fabricate(:user)
u.ip_address = '87.123.23.11'
AllowedIpAddressValidator.any_instance.expects(:validate_each).never
u.valid?
end
end
describe "trust levels" do
# NOTE be sure to use build to avoid db calls