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

### Home Classes Methods

### In Files

- lib/authlogic/acts_as_authentic/password.rb

### Methods

- #password
- #password=
- #randomize_password
- #randomize_password!
- #reset_password
- #reset_password!
- #valid_password?

### Files

- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- Authlogic
- Authlogic::ActsAsAuthentic
- Authlogic::ActsAsAuthentic::Base
- Authlogic::ActsAsAuthentic::Base::Config
- Authlogic::ActsAsAuthentic::Email
- Authlogic::ActsAsAuthentic::Email::Config
- Authlogic::ActsAsAuthentic::Email::Methods
- Authlogic::ActsAsAuthentic::LoggedInStatus
- Authlogic::ActsAsAuthentic::LoggedInStatus::Config
- Authlogic::ActsAsAuthentic::LoggedInStatus::Methods
- Authlogic::ActsAsAuthentic::LoggedInStatus::Methods::InstanceMethods
- Authlogic::ActsAsAuthentic::Login
- Authlogic::ActsAsAuthentic::Login::Config
- Authlogic::ActsAsAuthentic::Login::Methods
- Authlogic::ActsAsAuthentic::MagicColumns
- Authlogic::ActsAsAuthentic::MagicColumns::Methods
- Authlogic::ActsAsAuthentic::Password
- Authlogic::ActsAsAuthentic::Password::Callbacks
- Authlogic::ActsAsAuthentic::Password::Config
- Authlogic::ActsAsAuthentic::Password::Methods
- Authlogic::ActsAsAuthentic::Password::Methods::InstanceMethods
- Authlogic::ActsAsAuthentic::PerishableToken
- Authlogic::ActsAsAuthentic::PerishableToken::Config
- Authlogic::ActsAsAuthentic::PerishableToken::Methods
- Authlogic::ActsAsAuthentic::PerishableToken::Methods::ClassMethods
- Authlogic::ActsAsAuthentic::PerishableToken::Methods::InstanceMethods
- Authlogic::ActsAsAuthentic::PersistenceToken
- Authlogic::ActsAsAuthentic::PersistenceToken::Methods
- Authlogic::ActsAsAuthentic::PersistenceToken::Methods::ClassMethods
- Authlogic::ActsAsAuthentic::PersistenceToken::Methods::InstanceMethods
- Authlogic::ActsAsAuthentic::RestfulAuthentication
- Authlogic::ActsAsAuthentic::RestfulAuthentication::Config
- Authlogic::ActsAsAuthentic::RestfulAuthentication::InstanceMethods
- Authlogic::ActsAsAuthentic::SessionMaintenance
- Authlogic::ActsAsAuthentic::SessionMaintenance::Config
- Authlogic::ActsAsAuthentic::SessionMaintenance::Methods
- Authlogic::ActsAsAuthentic::SingleAccessToken
- Authlogic::ActsAsAuthentic::SingleAccessToken::Config
- Authlogic::ActsAsAuthentic::SingleAccessToken::Methods
- Authlogic::ActsAsAuthentic::SingleAccessToken::Methods::InstanceMethods
- Authlogic::ActsAsAuthentic::ValidationsScope
- Authlogic::ActsAsAuthentic::ValidationsScope::Config
- Authlogic::AuthenticatesMany
- Authlogic::AuthenticatesMany::Association
- Authlogic::AuthenticatesMany::Base
- Authlogic::ControllerAdapters
- Authlogic::ControllerAdapters::AbstractAdapter
- Authlogic::ControllerAdapters::MerbAdapter
- Authlogic::ControllerAdapters::MerbAdapter::MerbImplementation
- Authlogic::ControllerAdapters::RailsAdapter
- Authlogic::ControllerAdapters::RailsAdapter::AuthlogicLoadedTooLateError
- Authlogic::ControllerAdapters::RailsAdapter::RailsImplementation
- Authlogic::ControllerAdapters::SinatraAdapter
- Authlogic::ControllerAdapters::SinatraAdapter::Adapter
- Authlogic::ControllerAdapters::SinatraAdapter::Adapter::Implementation
- Authlogic::ControllerAdapters::SinatraAdapter::Controller
- Authlogic::ControllerAdapters::SinatraAdapter::Cookies
- Authlogic::CryptoProviders
- Authlogic::CryptoProviders::AES256
- Authlogic::CryptoProviders::BCrypt
- Authlogic::CryptoProviders::MD5
- Authlogic::CryptoProviders::Sha1
- Authlogic::CryptoProviders::Sha256
- Authlogic::CryptoProviders::Sha512
- Authlogic::CryptoProviders::Wordpress
- Authlogic::I18n
- Authlogic::I18n::Translator
- Authlogic::Random
- Authlogic::Regex
- Authlogic::Session
- Authlogic::Session::Activation
- Authlogic::Session::Activation::ClassMethods
- Authlogic::Session::Activation::InstanceMethods
- Authlogic::Session::ActiveRecordTrickery
- Authlogic::Session::ActiveRecordTrickery::ClassMethods
- Authlogic::Session::ActiveRecordTrickery::InstanceMethods
- Authlogic::Session::Base
- Authlogic::Session::BruteForceProtection
- Authlogic::Session::BruteForceProtection::Config
- Authlogic::Session::BruteForceProtection::InstanceMethods
- Authlogic::Session::Callbacks
- Authlogic::Session::Cookies
- Authlogic::Session::Cookies::Config
- Authlogic::Session::Cookies::InstanceMethods
- Authlogic::Session::Existence
- Authlogic::Session::Existence::ClassMethods
- Authlogic::Session::Existence::InstanceMethods
- Authlogic::Session::Foundation
- Authlogic::Session::Foundation::ClassMethods
- Authlogic::Session::Foundation::InstanceMethods
- Authlogic::Session::HttpAuth
- Authlogic::Session::HttpAuth::Config
- Authlogic::Session::HttpAuth::InstanceMethods
- Authlogic::Session::Id
- Authlogic::Session::Klass
- Authlogic::Session::Klass::Config
- Authlogic::Session::Klass::InstanceMethods
- Authlogic::Session::MagicColumns
- Authlogic::Session::MagicColumns::Config
- Authlogic::Session::MagicColumns::InstanceMethods
- Authlogic::Session::MagicStates
- Authlogic::Session::MagicStates::Config
- Authlogic::Session::MagicStates::InstanceMethods
- Authlogic::Session::Params
- Authlogic::Session::Params::Config
- Authlogic::Session::Params::InstanceMethods
- Authlogic::Session::Password
- Authlogic::Session::Password::Config
- Authlogic::Session::Password::InstanceMethods
- Authlogic::Session::PerishableToken
- Authlogic::Session::Persistence
- Authlogic::Session::Persistence::ClassMethods
- Authlogic::Session::Persistence::InstanceMethods
- Authlogic::Session::PriorityRecord
- Authlogic::Session::Scopes
- Authlogic::Session::Scopes::ClassMethods
- Authlogic::Session::Scopes::InstanceMethods
- Authlogic::Session::Session
- Authlogic::Session::Session::Config
- Authlogic::Session::Session::InstanceMethods
- Authlogic::Session::Timeout
- Authlogic::Session::Timeout::Config
- Authlogic::Session::Timeout::InstanceMethods
- Authlogic::Session::UnauthorizedRecord
- Authlogic::Session::Validation
- Authlogic::Session::Validation::Errors
- Authlogic::TestCase
- Authlogic::TestCase::MockController
- Authlogic::TestCase::MockLogger
- Authlogic::TestCase::RailsRequestAdapter
- Object

No matching classes.

# Authlogic::ActsAsAuthentic::Password::Methods::InstanceMethods

### Public Instance Methods

password() click to toggle source

The password

    # File lib/authlogic/acts_as_authentic/password.rb, line 229
    def password
      @password
    end

password=(pass) click to toggle source

This is a virtual method. Once a password is passed to it, it will create new password salt as well as encrypt the password.

    # File lib/authlogic/acts_as_authentic/password.rb, line 235
    def password=(pass)
      return if ignore_blank_passwords? && pass.blank?
      before_password_set
      @password = pass
      send("#{password_salt_field}=", Authlogic::Random.friendly_token) if password_salt_field
      send("#{crypted_password_field}=", crypto_provider.encrypt(*encrypt_arguments(@password, false, act_like_restful_authentication? ? :restful_authentication : nil)))
      @password_changed = true
      after_password_set
    end

randomize_password() click to toggle source
Alias for: reset_password
randomize_password!() click to toggle source
Alias for: reset_password!
reset_password() click to toggle source

Resets the password to a random friendly token.

    # File lib/authlogic/acts_as_authentic/password.rb, line 270
    def reset_password
      friendly_token = Authlogic::Random.friendly_token
      self.password = friendly_token
      self.password_confirmation = friendly_token
    end

Also aliased as: randomize_password
reset_password!() click to toggle source

Resets the password to a random friendly token and then saves the record.

    # File lib/authlogic/acts_as_authentic/password.rb, line 278
    def reset_password!
      reset_password
      save_without_session_maintenance(false)
    end

Also aliased as: randomize_password!
valid_password?(attempted_password, check_against_database = check_passwords_against_database?) click to toggle source

Accepts a raw password to determine if it is the correct password or not. Notice the second argument. That defaults to the value of check_passwords_against_database. See that method for mor information, but basically it just tells Authlogic to check the password against the value in the database or the value in the object.

    # File lib/authlogic/acts_as_authentic/password.rb, line 248
    def valid_password?(attempted_password, check_against_database = check_passwords_against_database?)
      crypted = check_against_database && send("#{crypted_password_field}_changed?") ? send("#{crypted_password_field}_was") : send(crypted_password_field)
      return false if attempted_password.blank? || crypted.blank?
      before_password_verification

      crypto_providers.each_with_index do |encryptor, index|
        # The arguments_type of for the transitioning from restful_authentication
        arguments_type = (act_like_restful_authentication? && index == 0) ||
          (transition_from_restful_authentication? && index > 0 && encryptor == Authlogic::CryptoProviders::Sha1) ?
          :restful_authentication : nil

        if encryptor.matches?(crypted, *encrypt_arguments(attempted_password, check_against_database, arguments_type))
          transition_password(attempted_password) if transition_password?(index, encryptor, crypted, check_against_database)
          after_password_verification
          return true
        end
      end

      false
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.