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



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/authlogic/acts_as_authentic/password.rb', line 287

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