Module: Authlogic::ActsAsAuthentic::Password::Config

### Home Classes Methods

### In Files

- lib/authlogic/acts_as_authentic/password.rb

### Methods

- #check_passwords_against_database
- #check_passwords_against_database=
- #crypted_password_field
- #crypted_password_field=
- #crypto_provider
- #crypto_provider=
- #ignore_blank_passwords
- #ignore_blank_passwords=
- #merge_validates_confirmation_of_password_field_options
- #merge_validates_length_of_password_confirmation_field_options
- #merge_validates_length_of_password_field_options
- #password_salt_field
- #password_salt_field=
- #require_password_confirmation
- #require_password_confirmation=
- #transition_from_crypto_providers
- #transition_from_crypto_providers=
- #validate_password_field
- #validate_password_field=
- #validates_confirmation_of_password_field_options
- #validates_confirmation_of_password_field_options=
- #validates_length_of_password_confirmation_field_options
- #validates_length_of_password_confirmation_field_options=
- #validates_length_of_password_field_options
- #validates_length_of_password_field_options=

### 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::Config

All configuration for the password aspect of acts_as_authentic.

### Public Instance Methods

check_passwords_against_database(value = nil) click to toggle source

When calling valid_password?(“some pass”) do you want to check that password against what’s in that object or whats in the datbase. Take this example:

    u = User.first
    u.password = "new pass"
    u.valid_password?("old pass")

Should the last line above return true or false? The record hasn’t been saved yet, so most would assume true. Other would assume false. So I let you decide by giving you this option.

- `Default:` true

- `Accepts:` Boolean

    # File lib/authlogic/acts_as_authentic/password.rb, line 72
    def check_passwords_against_database(value = nil)
      rw_config(:check_passwords_against_database, value, true)
    end

Also aliased as: check_passwords_against_database=
check_passwords_against_database=(value = nil) click to toggle source
Alias for: check_passwords_against_database
crypted_password_field(value = nil) click to toggle source

The name of the crypted_password field in the database.

- `Default:` :crypted_password, :encrypted_password, :password_hash, or :pw_hash

- `Accepts:` Symbol

    # File lib/authlogic/acts_as_authentic/password.rb, line 20
    def crypted_password_field(value = nil)
      rw_config(:crypted_password_field, value, first_column_to_exist(nil, :crypted_password, :encrypted_password, :password_hash, :pw_hash))
    end

Also aliased as: crypted_password_field=
crypted_password_field=(value = nil) click to toggle source
Alias for: crypted_password_field
crypto_provider(value = nil) click to toggle source

The class you want to use to encrypt and verify your encrypted passwords. See the Authlogic::CryptoProviders module for more info on the available methods and how to create your own.

- `Default:` CryptoProviders::Sha512

- `Accepts:` Class

    # File lib/authlogic/acts_as_authentic/password.rb, line 151
    def crypto_provider(value = nil)
      rw_config(:crypto_provider, value, CryptoProviders::Sha512)
    end

Also aliased as: crypto_provider=
crypto_provider=(value = nil) click to toggle source
Alias for: crypto_provider
ignore_blank_passwords(value = nil) click to toggle source

By default passwords are required when a record is new or the crypted_password is blank, but if both of these things are met a password is not required. In this case, blank passwords are ignored.

Think about a profile page, where the user can edit all of their information, including changing their password. If they do not want to change their password they just leave the fields blank. This will try to set the password to a blank value, in which case is incorrect behavior. As such, Authlogic ignores this. But let’s say you have a completely separate page for resetting passwords, you might not want to ignore blank passwords. If this is the case for you, then just set this value to false.

- `Default:` true

- `Accepts:` Boolean

    # File lib/authlogic/acts_as_authentic/password.rb, line 55
    def ignore_blank_passwords(value = nil)
      rw_config(:ignore_blank_passwords, value, true)
    end

Also aliased as: ignore_blank_passwords=
ignore_blank_passwords=(value = nil) click to toggle source
Alias for: ignore_blank_passwords
merge_validates_confirmation_of_password_field_options(options = {}) click to toggle source

See merge_validates_length_of_password_field_options. The same thing, except for validates_confirmation_of_password_field_options

    # File lib/authlogic/acts_as_authentic/password.rb, line 124
    def merge_validates_confirmation_of_password_field_options(options = {})
      self.validates_confirmation_of_password_field_options = validates_confirmation_of_password_field_options.merge(options)
    end

merge_validates_length_of_password_confirmation_field_options(options = {}) click to toggle source

See merge_validates_length_of_password_field_options. The same thing, except for validates_length_of_password_confirmation_field_options

    # File lib/authlogic/acts_as_authentic/password.rb, line 142
    def merge_validates_length_of_password_confirmation_field_options(options = {})
      self.validates_length_of_password_confirmation_field_options = validates_length_of_password_confirmation_field_options.merge(options)
    end

merge_validates_length_of_password_field_options(options = {}) click to toggle source

A convenience function to merge options into the validates_length_of_login_field_options. So intead of:

    self.validates_length_of_password_field_options = validates_length_of_password_field_options.merge(:my_option => my_value)

You can do this:

    merge_validates_length_of_password_field_options :my_option => my_value

    # File lib/authlogic/acts_as_authentic/password.rb, line 106
    def merge_validates_length_of_password_field_options(options = {})
      self.validates_length_of_password_field_options = validates_length_of_password_field_options.merge(options)
    end

password_salt_field(value = nil) click to toggle source

The name of the password_salt field in the database.

- `Default:` :password_salt, :pw_salt, :salt, nil if none exist

- `Accepts:` Symbol

    # File lib/authlogic/acts_as_authentic/password.rb, line 29
    def password_salt_field(value = nil)
      rw_config(:password_salt_field, value, first_column_to_exist(nil, :password_salt, :pw_salt, :salt))
    end

Also aliased as: password_salt_field=
password_salt_field=(value = nil) click to toggle source
Alias for: password_salt_field
require_password_confirmation(value = nil) click to toggle source

Whether or not to require a password confirmation. If you don’t want your users to confirm their password just set this to false.

- `Default:` true

- `Accepts:` Boolean

    # File lib/authlogic/acts_as_authentic/password.rb, line 39
    def require_password_confirmation(value = nil)
      rw_config(:require_password_confirmation, value, true)
    end

Also aliased as: require_password_confirmation=
require_password_confirmation=(value = nil) click to toggle source
Alias for: require_password_confirmation
transition_from_crypto_providers(value = nil) click to toggle source

Let’s say you originally encrypted your passwords with Sha1. Sha1 is starting to join the party with MD5 and you want to switch to something stronger. No problem, just specify your new and improved algorithm with the crypt_provider option and then let Authlogic know you are transitioning from Sha1 using this option. Authlogic will take care of everything, including transitioning your users to the new algorithm. The next time a user logs in, they will be granted access using the old algorithm and their password will be resaved with the new algorithm. All new users will obviously use the new algorithm as well.

Lastly, if you want to transition again, you can pass an array of crypto providers. So you can transition from as many algorithms as you want.

- `Default:` nil

- `Accepts:` Class or Array

    # File lib/authlogic/acts_as_authentic/password.rb, line 167
    def transition_from_crypto_providers(value = nil)
      rw_config(:transition_from_crypto_providers, (!value.nil? && [value].flatten.compact) || value, [])
    end

Also aliased as: transition_from_crypto_providers=
transition_from_crypto_providers=(value = nil) click to toggle source
Alias for: transition_from_crypto_providers
validate_password_field(value = nil) click to toggle source

Whether or not to validate the password field.

- `Default:` true

- `Accepts:` Boolean

    # File lib/authlogic/acts_as_authentic/password.rb, line 81
    def validate_password_field(value = nil)
      rw_config(:validate_password_field, value, true)
    end

Also aliased as: validate_password_field=
validate_password_field=(value = nil) click to toggle source
Alias for: validate_password_field
validates_confirmation_of_password_field_options(value = nil) click to toggle source

A hash of options for the validates_confirmation_of call for the password field. Allows you to change this however you want.

Keep in mind this is ruby. I wanted to keep this as flexible as possible, so you can completely replace the hash or merge options into it. Checkout the convenience function merge_validates_length_of_password_field_options to merge options.

- `Default:` {:if => :require_password?}

- `Accepts:` Hash of options accepted by validates_confirmation_of

    # File lib/authlogic/acts_as_authentic/password.rb, line 118
    def validates_confirmation_of_password_field_options(value = nil)
      rw_config(:validates_confirmation_of_password_field_options, value, {:if => :require_password?})
    end

Also aliased as: validates_confirmation_of_password_field_options=
validates_confirmation_of_password_field_options=(value = nil) click to toggle source
Alias for: validates_confirmation_of_password_field_options
validates_length_of_password_confirmation_field_options(value = nil) click to toggle source

A hash of options for the validates_length_of call for the password_confirmation field. Allows you to change this however you want.

Keep in mind this is ruby. I wanted to keep this as flexible as possible, so you can completely replace the hash or merge options into it. Checkout the convenience function merge_validates_length_of_password_field_options to merge options.

- `Default:` validates_length_of_password_field_options

- `Accepts:` Hash of options accepted by validates_length_of

    # File lib/authlogic/acts_as_authentic/password.rb, line 136
    def validates_length_of_password_confirmation_field_options(value = nil)
      rw_config(:validates_length_of_password_confirmation_field_options, value, validates_length_of_password_field_options)
    end

Also aliased as: validates_length_of_password_confirmation_field_options=
validates_length_of_password_confirmation_field_options=(value = nil) click to toggle source
Alias for: validates_length_of_password_confirmation_field_options
validates_length_of_password_field_options(value = nil) click to toggle source

A hash of options for the validates_length_of call for the password field. Allows you to change this however you want.

Keep in mind this is ruby. I wanted to keep this as flexible as possible, so you can completely replace the hash or merge options into it. Checkout the convenience function merge_validates_length_of_password_field_options to merge options.

- `Default:` {:minimum => 4, :if => :require_password?}

- `Accepts:` Hash of options accepted by validates_length_of

    # File lib/authlogic/acts_as_authentic/password.rb, line 94
    def validates_length_of_password_field_options(value = nil)
      rw_config(:validates_length_of_password_field_options, value, {:minimum => 4, :if => :require_password?})
    end

Also aliased as: validates_length_of_password_field_options=
validates_length_of_password_field_options=(value = nil) click to toggle source
Alias for: validates_length_of_password_field_options

[Validate]

Generated with the Darkfish Rdoc Generator 2.