Class: Devise::Strategies::Rememberable
- Inherits:
-
Authenticatable
- Object
- Warden::Strategies::Base
- Base
- Authenticatable
- Devise::Strategies::Rememberable
- Defined in:
- lib/devise/strategies/rememberable.rb
Overview
Remember the user through the remember token. This strategy is responsible to verify whether there is a cookie with the remember token, and to recreate the user from this cookie if it exists. Must be called before authenticatable.
Instance Attribute Summary (collapse)
-
- (Object) authentication_hash
inherited
from Authenticatable
Returns the value of attribute authentication_hash.
-
- (Object) authentication_type
inherited
from Authenticatable
Returns the value of attribute authentication_type.
-
- (Object) password
inherited
from Authenticatable
Returns the value of attribute password.
Instance Method Summary (collapse)
-
- (Object) authenticate!
To authenticate a user we deserialize the cookie and attempt finding the record in the database.
-
- (Boolean) valid?
A valid strategy for rememberable needs a remember token in the cookies.
Instance Attribute Details
- (Object) authentication_hash Originally defined in class Authenticatable
Returns the value of attribute authentication_hash
- (Object) authentication_type Originally defined in class Authenticatable
Returns the value of attribute authentication_type
- (Object) password Originally defined in class Authenticatable
Returns the value of attribute password
Instance Method Details
- (Object) authenticate!
To authenticate a user we deserialize the cookie and attempt finding the record in the database. If the attempt fails, we pass to another strategy handle the authentication.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/devise/strategies/rememberable.rb', line 19 def authenticate! resource = mapping.to.(*) unless resource .delete(remember_key) return pass end if validate(resource) success!(resource) end end |
- (Boolean) valid?
A valid strategy for rememberable needs a remember token in the cookies.
11 12 13 14 |
# File 'lib/devise/strategies/rememberable.rb', line 11 def valid? @remember_cookie = nil .present? end |