mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Issue 4763: Change login errors for when in paranoid mode
This commit is contained in:
parent
cd9ad848fb
commit
1c8e97c75a
2 changed files with 16 additions and 1 deletions
|
@ -17,7 +17,9 @@ module Devise
|
|||
end
|
||||
|
||||
mapping.to.new.password = password if !hashed && Devise.paranoid
|
||||
fail(:not_found_in_database) unless resource
|
||||
unless resource
|
||||
Devise.paranoid ? fail(:invalid) : fail(:not_found_in_database)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -74,6 +74,19 @@ class DatabaseAuthenticationTest < Devise::IntegrationTest
|
|||
refute warden.authenticated?(:admin)
|
||||
end
|
||||
|
||||
test 'when in paranoid mode and without a valid e-mail' do
|
||||
swap Devise, paranoid: true do
|
||||
store_translations :en, devise: { failure: { not_found_in_database: 'Not found in database' } } do
|
||||
sign_in_as_user do
|
||||
fill_in 'email', with: 'wrongemail@test.com'
|
||||
end
|
||||
|
||||
assert_not_contain 'Not found in database'
|
||||
assert_contain 'Invalid Email or password.'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
test 'error message is configurable by resource name' do
|
||||
store_translations :en, devise: { failure: { admin: { invalid: "Invalid credentials" } } } do
|
||||
sign_in_as_admin do
|
||||
|
|
Loading…
Reference in a new issue