diff --git a/lib/sorcery/model.rb b/lib/sorcery/model.rb index 395710cf..6a500fc4 100644 --- a/lib/sorcery/model.rb +++ b/lib/sorcery/model.rb @@ -102,10 +102,6 @@ def authenticate(*credentials, &block) set_encryption_attributes - unless user.valid_password?(credentials[1]) - return authentication_response(user: user, failure: :invalid_password, &block) - end - if user.respond_to?(:active_for_authentication?) && !user.active_for_authentication? return authentication_response(user: user, failure: :inactive, &block) end @@ -118,6 +114,10 @@ def authenticate(*credentials, &block) end end + unless user.valid_password?(credentials[1]) + return authentication_response(user: user, failure: :invalid_password, &block) + end + authentication_response(user: user, return_value: user, &block) end