Module: TranslationCms::Authenticatable
- Extended by:
- ActiveSupport::Concern
- Included in:
- TranslationCms::Api::Customer
- Defined in:
- lib/translation_cms/authenticatable.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #active_for_authentication? ⇒ Boolean
- #after_database_authentication ⇒ Object
- #authenticatable_salt ⇒ Object
- #inactive_message ⇒ Object
- #unauthenticated_message ⇒ Object
-
#valid_for_authentication? ⇒ Boolean
Check if the current object is valid for authentication.
- #valid_password?(password) ⇒ Boolean
Instance Method Details
#active_for_authentication? ⇒ Boolean
59 60 61 |
# File 'lib/translation_cms/authenticatable.rb', line 59 def active_for_authentication? true end |
#after_database_authentication ⇒ Object
71 72 73 |
# File 'lib/translation_cms/authenticatable.rb', line 71 def after_database_authentication # RequestStore.store[:access_token] = session.access_token end |
#authenticatable_salt ⇒ Object
47 |
# File 'lib/translation_cms/authenticatable.rb', line 47 def authenticatable_salt; end |
#inactive_message ⇒ Object
63 64 65 |
# File 'lib/translation_cms/authenticatable.rb', line 63 def :inactive end |
#unauthenticated_message ⇒ Object
67 68 69 |
# File 'lib/translation_cms/authenticatable.rb', line 67 def :invalid end |
#valid_for_authentication? ⇒ Boolean
Check if the current object is valid for authentication. This method and find_for_authentication are the methods used in a Warden::Strategy to check if a model should be signed in or not.
However, you should not overwrite this method, you should overwrite active_for_authentication? and inactive_message instead.
55 56 57 |
# File 'lib/translation_cms/authenticatable.rb', line 55 def valid_for_authentication? block_given? ? yield : true end |
#valid_password?(password) ⇒ Boolean
75 76 77 |
# File 'lib/translation_cms/authenticatable.rb', line 75 def valid_password?(password) password.present? && token.present? && session.errors.empty? end |