diff --git a/rest_framework_simplejwt/serializers.py b/rest_framework_simplejwt/serializers.py index e75e709c9..515f9a14d 100644 --- a/rest_framework_simplejwt/serializers.py +++ b/rest_framework_simplejwt/serializers.py @@ -53,6 +53,10 @@ def validate(self, attrs: Dict[str, Any]) -> Dict[Any, Any]: self.user = authenticate(**authenticate_kwargs) + if not user: + msg = _("Unable to log in with provided credentials.") + raise serializers.ValidationError(msg, code="authorization") + if not api_settings.USER_AUTHENTICATION_RULE(self.user): raise exceptions.AuthenticationFailed( self.error_messages["no_active_account"],