1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Added required_fields to recoverable

This commit is contained in:
Rodrigo Flores 2012-02-20 09:14:06 -02:00
parent bee87843b4
commit ce3422e75a
2 changed files with 12 additions and 1 deletions

View file

@ -24,6 +24,10 @@ module Devise
module Recoverable
extend ActiveSupport::Concern
def self.required_fields(klass)
[:reset_password_sent_at, :reset_password_token]
end
# Update password saving the record and clearing token. Returns true if
# the passwords are valid and the record was saved, false otherwise.
def reset_password!(new_password, new_password_confirmation)

View file

@ -195,4 +195,11 @@ class RecoverableTest < ActiveSupport::TestCase
assert_equal "has expired, please request a new one", reset_password_user.errors[:reset_password_token].join
end
end
end
test 'required_fields should contain the fields that Devise uses' do
assert_equal Devise::Models::Recoverable.required_fields(User), [
:reset_password_sent_at,
:reset_password_token
]
end
end