Skip to content

Instantly share code, notes, and snippets.

@gvt
Created October 2, 2013 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gvt/6798494 to your computer and use it in GitHub Desktop.
Save gvt/6798494 to your computer and use it in GitHub Desktop.
Authlogic::Session::MagicColumns::InstanceMethods#update_info
def update_info
record.login_count = (record.login_count.blank? ? 1 : record.login_count + 1) if record.respond_to?(:login_count)
record.failed_login_count = 0 if record.respond_to?(:failed_login_count)
if record.respond_to?(:current_login_at)
record.last_login_at = record.current_login_at if record.respond_to?(:last_login_at)
record.current_login_at = klass.default_timezone == :utc ? Time.now.utc : Time.now
end
if record.respond_to?(:current_login_ip)
record.last_login_ip = record.current_login_ip if record.respond_to?(:last_login_ip)
record.current_login_ip = controller.request.remote_ip
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment