Class: Devise::Strategies::DatabaseAuthenticatable
- Inherits:
-
Base
- Object
- Warden::Strategies::Base
- Base
- Devise::Strategies::DatabaseAuthenticatable
- Defined in:
- lib/devise/strategies/database_authenticatable.rb
Overview
Default strategy for signing in a user, based on his email and password. Redirects to sign_in page if it’s not authenticated
Instance Method Summary collapse
-
#authenticate! ⇒ Object
Authenticate a user based on email and password params, returning to warden success and the authenticated user if everything is okay.
- #valid? ⇒ Boolean
Methods inherited from Base
Instance Method Details
#authenticate! ⇒ Object
Authenticate a user based on email and password params, returning to warden success and the authenticated user if everything is okay. Otherwise redirect to sign in page.
15 16 17 18 19 20 21 |
# File 'lib/devise/strategies/database_authenticatable.rb', line 15 def authenticate! if resource = mapping.to.authenticate(params[scope]) success!(resource) else fail(:invalid) end end |
#valid? ⇒ Boolean
8 9 10 |
# File 'lib/devise/strategies/database_authenticatable.rb', line 8 def valid? valid_controller? && valid_params? && mapping.to.respond_to?(:authenticate) end |