module Authlogic::Session::MagicColumns
Just like ActiveRecord has “magic” columns, such as: created_at and updated_at. Authlogic has its own “magic” columns too:
-
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 ip when an explicit login is made.
-
last_login_ip - Updates with the value of current_login_ip before it is reset.
Public Class Methods
# File lib/authlogic/session/magic_columns.rb, line 18 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