Class: Monban::Strategies::PasswordStrategy
- Inherits:
-
Warden::Strategies::Base
- Object
- Warden::Strategies::Base
- Monban::Strategies::PasswordStrategy
- Defined in:
- lib/monban/strategies/password_strategy.rb
Overview
Password strategy for warden
Instance Method Summary collapse
-
#authenticate! ⇒ Object
Authenticates for warden.
-
#valid? ⇒ Boolean
Checks if strategy should be executed.
Instance Method Details
#authenticate! ⇒ Object
Authenticates for warden
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
11 12 13 |
# File 'lib/monban/strategies/password_strategy.rb', line 11 def valid? lookup_field_value || token_field_value end |