module Authlogic::ActsAsAuthentic::PersistenceToken::Methods

Methods for the persistence token.

Public Class Methods

included(klass) click to toggle source
# File lib/authlogic/acts_as_authentic/persistence_token.rb, line 14
def self.included(klass)
  klass.class_eval do
    extend ClassMethods
    include InstanceMethods
    
    if respond_to?(:after_password_set) && respond_to?(:after_password_verification)
      after_password_set :reset_persistence_token
      after_password_verification :reset_persistence_token!, :if => :reset_persistence_token?
    end
    
    validates_presence_of :persistence_token
    validates_uniqueness_of :persistence_token, :if => :persistence_token_changed?
    
    before_validation :reset_persistence_token, :if => :reset_persistence_token?
  end
end