mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
lock_access! better failure message
This commit is contained in:
@@ -115,10 +115,10 @@ module Devise
|
||||
# leaks the existence of an account.
|
||||
if Devise.paranoid
|
||||
super
|
||||
elsif access_locked? || (lock_strategy_enabled?(:failed_attempts) && attempts_exceeded?)
|
||||
:locked
|
||||
elsif lock_strategy_enabled?(:failed_attempts) && last_attempt?
|
||||
:last_attempt
|
||||
elsif lock_strategy_enabled?(:failed_attempts) && attempts_exceeded?
|
||||
:locked
|
||||
else
|
||||
super
|
||||
end
|
||||
|
||||
@@ -313,4 +313,14 @@ class LockableTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
test 'should return locked message if user was programatically locked' do
|
||||
swap Devise, last_attempt_warning: :true do
|
||||
swap Devise, lock_strategy: :failed_attempts do
|
||||
user = create_user
|
||||
user.lock_access!
|
||||
assert_equal :locked, user.unauthenticated_message
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user