Class: Sinatra::Doorman::RememberMeStrategy
- Inherits:
-
Warden::Strategies::Base
- Object
- Warden::Strategies::Base
- Sinatra::Doorman::RememberMeStrategy
- Defined in:
- lib/doorman/base.rb
Instance Method Summary collapse
Instance Method Details
#authenticate! ⇒ Object
143 144 145 146 147 148 149 |
# File 'lib/doorman/base.rb', line 143 def authenticate! token = env['rack.cookies'][COOKIE_KEY] return unless token user = User.first(:remember_token => token) env['rack.cookies'].delete(COOKIE_KEY) and return if user.nil? success!(user) end |
#valid? ⇒ Boolean
139 140 141 |
# File 'lib/doorman/base.rb', line 139 def valid? !!env['rack.cookies'][COOKIE_KEY] end |