Module: Janus::Models::TokenAuthenticatable::ClassMethods
- Defined in:
- lib/janus/models/token_authenticatable.rb
Instance Method Summary collapse
Instance Method Details
#expired_authentication_token?(record) ⇒ Boolean
72 73 74 75 |
# File 'lib/janus/models/token_authenticatable.rb', line 72 def expired_authentication_token?(record) token_authentication_valid_for && record.authentication_token_created_at && record.authentication_token_created_at < Time.now - token_authentication_valid_for end |
#find_for_token_authentication(token) ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/janus/models/token_authenticatable.rb', line 61 def find_for_token_authentication(token) if record = where(:authentication_token => token).first if expired_authentication_token?(record) record.destroy_authentication_token! return end record.destroy_authentication_token! unless reusable_authentication_token record end end |