Module: Authlogic::Session::MagicColumns

Included in:
Base
Defined in:
lib/authlogic/session/magic_columns.rb

Overview

Just like ActiveRecord has “magic” columns, such as: created_at and updated_at. Authlogic has its own “magic” columns too:

Column name           Description
login_count           Increased every time an explicit login is made. This will *NOT* increase if logging in by a session, cookie, or basic http auth
failed_login_count    This increases for each consecutive failed login. See Authlogic::Session::BruteForceProtection and the consecutive_failed_logins_limit config option for more details.
last_request_at       Updates every time the user logs in, either by explicitly logging in, or logging in by cookie, session, or http auth
current_login_at      Updates with the current time when an explicit login is made.
last_login_at         Updates with the value of current_login_at before it is reset.
current_login_ip      Updates with the request remote_ip when an explicit login is made.
last_login_ip         Updates with the value of current_login_ip before it is reset.

Defined Under Namespace

Modules: Config, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/authlogic/session/magic_columns.rb', line 14

def self.included(klass)
  klass.class_eval do
    extend Config
    include InstanceMethods
    after_persisting :set_last_request_at, :if => :set_last_request_at?
    validate :increase_failed_login_count
    before_save :update_info
    before_save :set_last_request_at, :if => :set_last_request_at?
  end
end