Module | Authlogic::ActsAsAuthentic::Password::Config |
In: |
lib/authlogic/acts_as_authentic/password.rb
|
All configuration for the password aspect of acts_as_authentic.
When calling valid_password?("some pass") do you want to check that password against what‘s in that object or whats in the database. 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.
The name of the crypted_password field in the database.
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.
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.
See merge_validates_length_of_password_field_options. The same thing, except for validates_confirmation_of_password_field_options
See merge_validates_length_of_password_field_options. The same thing, except for validates_length_of_password_confirmation_field_options
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
The name of the password_salt field in the database.
Whether or not to require a password confirmation. If you don‘t want your users to confirm their password just set this to false.
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.
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.
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.
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.