Class: UserBouncer

Inherits:
Object
  • Object
show all
Defined in:
app/services/user_bouncer.rb

Instance Method Summary collapse

Constructor Details

#initialize(user, tracking) ⇒ UserBouncer

Returns a new instance of UserBouncer.

Parameters:

  • user (User)
  • tracking (Hash)


4
5
6
7
# File 'app/services/user_bouncer.rb', line 4

def initialize(user, tracking)
  @user     = user
  @tracking = tracking
end

Instance Method Details

#let_user_in?(password) ⇒ Boolean

Parameters:

  • password (String)

Returns:

  • (Boolean)


10
11
12
13
14
15
# File 'app/services/user_bouncer.rb', line 10

def let_user_in?(password)
  return false unless @user&.allow_login?

  @password = password
  too_many_attempts? ? (log_attempt && false) : try_password
end