FEATURE: don't limit registration from an IP address if a staff member has that IP address

This commit is contained in:
Régis Hanol
2014-11-21 00:25:44 +01:00
parent 4a7e0416d1
commit ced35cb3bb
3 changed files with 23 additions and 3 deletions

View File

@ -9,6 +9,13 @@ class SpamHandler
return false if tl2_plus_accounts_with_same_ip > 0
staff_user_ids = Group[:staff].user_ids - [-1]
staff_members_with_same_ip = User.where(id: staff_user_ids)
.where("ip_address = ?", ip_address.to_s)
.count
return false if staff_members_with_same_ip > 0
tl0_accounts_with_same_ip = User.unscoped
.where(trust_level: TrustLevel[0])
.where("ip_address = ?", ip_address.to_s)