Class: Monban::Strategies::PasswordStrategy

Inherits:
Warden::Strategies::Base
  • Object
show all
Defined in:
lib/monban/strategies/password_strategy.rb

Overview

Password strategy for warden

Since:

  • 0.0.15

Instance Method Summary collapse

Instance Method Details

#authenticate!Object

Authenticates for warden

Since:

  • 0.0.15



17
18
19
20
21
# File 'lib/monban/strategies/password_strategy.rb', line 17

def authenticate!
  user = Monban.config.user_class.find_by(lookup_field => lookup_field_value)
  auth = Monban.config.authentication_service.new(user, token_field_value)
  auth.authenticated? ? success!(user) : fail!("Could not log in")
end

#valid?Boolean

Checks if strategy should be executed

Returns:

  • (Boolean)

Since:

  • 0.0.15



11
12
13
# File 'lib/monban/strategies/password_strategy.rb', line 11

def valid?
  lookup_field_value || token_field_value
end