mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +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:
parent
e527cbf884
commit
648b11a0eb
29 changed files with 455 additions and 12 deletions
30
db/fixtures/screened_ip_addresses.rb
Normal file
30
db/fixtures/screened_ip_addresses.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
ScreenedIpAddress.seed do |s|
|
||||
s.id = 1
|
||||
s.ip_address = "10.0.0.0/8"
|
||||
s.action_type = ScreenedIpAddress.actions[:do_nothing]
|
||||
end
|
||||
|
||||
ScreenedIpAddress.seed do |s|
|
||||
s.id = 2
|
||||
s.ip_address = "192.168.0.0/16"
|
||||
s.action_type = ScreenedIpAddress.actions[:do_nothing]
|
||||
end
|
||||
|
||||
ScreenedIpAddress.seed do |s|
|
||||
s.id = 3
|
||||
s.ip_address = "127.0.0.0/8"
|
||||
s.action_type = ScreenedIpAddress.actions[:do_nothing]
|
||||
end
|
||||
|
||||
ScreenedIpAddress.seed do |s|
|
||||
s.id = 4
|
||||
s.ip_address = "172.16.0.0/12"
|
||||
s.action_type = ScreenedIpAddress.actions[:do_nothing]
|
||||
end
|
||||
|
||||
# IPv6
|
||||
ScreenedIpAddress.seed do |s|
|
||||
s.id = 5
|
||||
s.ip_address = "fc00::/7"
|
||||
s.action_type = ScreenedIpAddress.actions[:do_nothing]
|
||||
end
|
13
db/migrate/20131017205954_create_screened_ip_addresses.rb
Normal file
13
db/migrate/20131017205954_create_screened_ip_addresses.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
class CreateScreenedIpAddresses < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :screened_ip_addresses do |t|
|
||||
t.column :ip_address, :inet, null: false
|
||||
t.integer :action_type, null: false
|
||||
t.integer :match_count, null: false, default: 0
|
||||
t.datetime :last_match_at
|
||||
t.timestamps
|
||||
end
|
||||
add_index :screened_ip_addresses, :ip_address, unique: true
|
||||
add_index :screened_ip_addresses, :last_match_at
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue