Module: Trestle::Auth::ModelMethods::Rememberable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/trestle/auth/model_methods/rememberable.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#forget_me! ⇒ Object
11 12 13 |
# File 'lib/trestle/auth/model_methods/rememberable.rb', line 11 def forget_me! update(remember_token: nil, remember_token_expires_at: nil) end |
#remember_me! ⇒ Object
7 8 9 |
# File 'lib/trestle/auth/model_methods/rememberable.rb', line 7 def remember_me! update(remember_token: SecureRandom.urlsafe_base64(15), remember_token_expires_at: Time.now + Trestle.config.auth.remember.for) end |
#remember_token_expired? ⇒ Boolean
15 16 17 |
# File 'lib/trestle/auth/model_methods/rememberable.rb', line 15 def remember_token_expired? remember_token_expires_at.nil? || Time.now > remember_token_expires_at end |