separated out ip ban logic from regular bans, users can no longer register if an ip ban is in place
This commit is contained in:
@@ -5,14 +5,10 @@ class Ban < ActiveRecord::Base
|
||||
attr_accessible :reason, :duration, :user_id
|
||||
validate :user_is_inferior
|
||||
|
||||
def self.is_user_banned?(user)
|
||||
def self.is_banned?(user)
|
||||
exists?(["user_id = ? AND expires_at > ?", user.id, Time.now])
|
||||
end
|
||||
|
||||
def self.is_ip_banned?(ip_addr)
|
||||
exists?(["ip_addr = ? AND expires_at > ?", ip_addr, Time.now])
|
||||
end
|
||||
|
||||
def user_is_inferior
|
||||
if user
|
||||
if user.is_admin?
|
||||
|
||||
Reference in New Issue
Block a user