mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Required fields on encryptable
This commit is contained in:
parent
6489354b0e
commit
533511f8c3
2 changed files with 15 additions and 1 deletions
|
@ -24,6 +24,14 @@ module Devise
|
|||
attr_accessor :password_confirmation
|
||||
end
|
||||
|
||||
module ModuleMethods
|
||||
extend self
|
||||
|
||||
def required_fields
|
||||
[:password_salt]
|
||||
end
|
||||
end
|
||||
|
||||
# Generates password salt.
|
||||
def password=(new_password)
|
||||
self.password_salt = self.class.password_salt if new_password.present?
|
||||
|
@ -69,4 +77,4 @@ module Devise
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -64,4 +64,10 @@ class EncryptableTest < ActiveSupport::TestCase
|
|||
admin.save
|
||||
assert_not admin.valid_password?('123456')
|
||||
end
|
||||
|
||||
test 'required_fields should contain the fields that Devise uses' do
|
||||
assert_equal Devise::Models::Encryptable::ModuleMethods.required_fields, [
|
||||
:password_salt
|
||||
]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue