Module: Authlogic::ActsAsAuthentic::Password::Callbacks

Defined in:
lib/authlogic/acts_as_authentic/password.rb

Overview

Callbacks / hooks to allow other modules to modify the behavior of this module.

Constant Summary collapse

METHODS =

Does the order of this array matter?

%w[
  before_password_set
  after_password_set
  before_password_verification
  after_password_verification
].freeze

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/authlogic/acts_as_authentic/password.rb', line 290

def self.included(klass)
  return if klass.crypted_password_field.nil?
  klass.define_callbacks(*METHODS)

  # If Rails 3, support the new callback syntax
  if klass.singleton_class.method_defined?(:set_callback)
    METHODS.each do |method|
      klass.class_eval <<-EOS, __FILE__, __LINE__ + 1
        def self.#{method}(*methods, &block)
          set_callback :#{method}, *methods, &block
        end
      EOS
    end
  end
end