mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
Bring password_digest back.
This method is part of the protected API and is used by custom encryption engines (like `devise-encryptable`) to hook the custom encryption logic in the models. Fixes #2730
This commit is contained in:
@@ -93,6 +93,11 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
|
||||
assert_present user.encrypted_password
|
||||
end
|
||||
|
||||
test 'should support custom encryption methods' do
|
||||
user = UserWithCustomEncryption.new(:password => '654321')
|
||||
assert_equal user.encrypted_password, '123456'
|
||||
end
|
||||
|
||||
test 'allow authenticatable_salt to work even with nil encrypted password' do
|
||||
user = User.new
|
||||
user.encrypted_password = nil
|
||||
|
||||
@@ -12,6 +12,13 @@ class UserWithValidation < User
|
||||
validates_presence_of :username
|
||||
end
|
||||
|
||||
class UserWithCustomEncryption < User
|
||||
protected
|
||||
def password_digest(password)
|
||||
password.reverse
|
||||
end
|
||||
end
|
||||
|
||||
class UserWithVirtualAttributes < User
|
||||
devise :case_insensitive_keys => [ :email, :email_confirmation ]
|
||||
validates :email, :presence => true, :confirmation => {:on => :create}
|
||||
|
||||
Reference in New Issue
Block a user