mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-10 08:08:00 -05:00
Added required fields to lockable
This commit is contained in:
@@ -22,6 +22,10 @@ module Devise
|
||||
|
||||
delegate :lock_strategy_enabled?, :unlock_strategy_enabled?, :to => "self.class"
|
||||
|
||||
def self.required_fields(klass)
|
||||
[:failed_attempts, :unlock_at, :unlock_token]
|
||||
end
|
||||
|
||||
# Lock a user setting its locked_at to actual time.
|
||||
def lock_access!
|
||||
self.locked_at = Time.now.utc
|
||||
|
||||
@@ -235,4 +235,12 @@ class LockableTest < ActiveSupport::TestCase
|
||||
assert_nil user.locked_at
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
test 'required_fields should contain the fields that Devise uses' do
|
||||
assert_equal Devise::Models::Lockable.required_fields(User).sort, [
|
||||
:failed_attempts,
|
||||
:unlock_at,
|
||||
:unlock_token
|
||||
]
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user