rails/rails — pull request #6684 by bricker88 (2012-06-08 20:13:59+00:00)
Title: Remove naming constraints from has_secure_password

This commit makes available two new options to has_secure_password:

- encrypted_attribute: The attribute for the encrypted password.
Replaces the hard-coded `password_digest` attribute

- password_attribute: The instance method for the password
Replaces the hard-coded `password` method

Example usage:

# Schema: User(name:string, encrypted_password:string)
class User < ActiveRecord::Base
has_secure_password :encrypted_attribute => :encrypted_password,
:password_attribute => :passw
end

The User model will now use `encrypted_password` for the digested password, and
will make available @user.passw.

With no options specified, defaults are `password_digest` and `password`, so no
action will be required to update this method from older versions.

Note: config.filter_parameters will need to be changed from the default `password` if
something different is being used.

Use cases: Legacy database (eg. Django applications use a `password` column for digest), conflicting plugins