1
0
Fork 0
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:
Tony Correia 2018-04-27 22:19:58 -07:00 committed by Leonardo Tegon
parent cd9ad848fb
commit 1c8e97c75a
2 changed files with 16 additions and 1 deletions

View file

@ -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

View file

@ -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