mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: only limit new registrations from that IP if all the users from that IP are TL1 or TL0
This commit is contained in:
parent
fae19aa56c
commit
c5f9dd4ef3
3 changed files with 26 additions and 9 deletions
|
@ -3,6 +3,12 @@ class SpamHandler
|
|||
def self.should_prevent_registration_from_ip?(ip_address)
|
||||
return false if SiteSetting.max_new_accounts_per_registration_ip <= 0
|
||||
|
||||
tl2_plus_accounts_with_same_ip = User.where("trust_level >= ?", TrustLevel[2])
|
||||
.where("ip_address = ?", ip_address.to_s)
|
||||
.count
|
||||
|
||||
return false if tl2_plus_accounts_with_same_ip > 0
|
||||
|
||||
tl0_accounts_with_same_ip = User.unscoped
|
||||
.where(trust_level: TrustLevel[0])
|
||||
.where("ip_address = ?", ip_address.to_s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue