diff --git a/lib/devise_two_factor/strategies/two_factor_authenticatable.rb b/lib/devise_two_factor/strategies/two_factor_authenticatable.rb index b9f1b06..fe89230 100644 --- a/lib/devise_two_factor/strategies/two_factor_authenticatable.rb +++ b/lib/devise_two_factor/strategies/two_factor_authenticatable.rb @@ -12,7 +12,7 @@ def authenticate! super end - fail(:not_found_in_database) unless resource + fail(Devise.paranoid ? :invalid : :not_found_in_database) unless resource # We want to cascade to the next strategy if this one fails, # but database authenticatable automatically halts on a bad password diff --git a/lib/devise_two_factor/strategies/two_factor_backupable.rb b/lib/devise_two_factor/strategies/two_factor_backupable.rb index 8ed941d..2b1407f 100644 --- a/lib/devise_two_factor/strategies/two_factor_backupable.rb +++ b/lib/devise_two_factor/strategies/two_factor_backupable.rb @@ -12,7 +12,7 @@ def authenticate! super end - fail(:not_found_in_database) unless resource + fail(Devise.paranoid ? :invalid : :not_found_in_database) unless resource # We want to cascade to the next strategy if this one fails, # but database authenticatable automatically halts on a bad password