Module: Authlogic::ActsAsAuthentic::Password::Methods

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

Overview

The methods related to the password field.

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/authlogic/acts_as_authentic/password.rb', line 321

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

  klass.class_eval do
    include InstanceMethods

    if validate_password_field
      validates_length_of :password, validates_length_of_password_field_options

      if require_password_confirmation
        validates_confirmation_of(
          :password,
          validates_confirmation_of_password_field_options
        )
        validates_length_of(
          :password_confirmation,
          validates_length_of_password_confirmation_field_options
        )
      end
    end

    after_save :reset_password_changed
  end
end