Module: Authlogic::Session::MagicStates
- Included in:
- Base
- Defined in:
- lib/authlogic/session/magic_states.rb
Overview
Authlogic tries to check the state of the record before creating the session. If your record responds to the following methods and any of them return false, validation will fail:
Method name Description
active? Is the record marked as active?
approved? Has the record been approved?
confirmed? Has the record been conirmed?
Authlogic does nothing to define these methods for you, its up to you to define what they mean. If your object responds to these methods Authlogic will use them, otherwise they are ignored.
What’s neat about this is that these are checked upon any type of login. When logging in explicitly, by cookie, session, or basic http auth. So if you mark a user inactive in the middle of their session they wont be logged back in next time they refresh the page. Giving you complete control.
Need Authlogic to check your own “state”? No problem, check out the hooks section below. Add in a before_validation to do your own checking. The sky is the limit.
Defined Under Namespace
Modules: Config, InstanceMethods
Class Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/authlogic/session/magic_states.rb', line 17 def self.included(klass) klass.class_eval do extend Config include InstanceMethods validate :validate_magic_states, :unless => :disable_magic_states? end end |