diff --git a/authentik/api/schema.py b/authentik/api/schema.py index 8e27c4037..e70caaf3e 100644 --- a/authentik/api/schema.py +++ b/authentik/api/schema.py @@ -9,6 +9,7 @@ from drf_spectacular.plumbing import ( ) from drf_spectacular.settings import spectacular_settings from drf_spectacular.types import OpenApiTypes +from rest_framework.settings import api_settings from authentik.api.pagination import PAGINATION_COMPONENT_NAME, PAGINATION_SCHEMA @@ -31,7 +32,7 @@ GENERIC_ERROR = build_object_type( VALIDATION_ERROR = build_object_type( description=_("Validation Error"), properties={ - "non_field_errors": build_array_type(build_standard_type(OpenApiTypes.STR)), + api_settings.NON_FIELD_ERRORS_KEY: build_array_type(build_standard_type(OpenApiTypes.STR)), "code": build_standard_type(OpenApiTypes.STR), }, required=[], diff --git a/authentik/blueprints/v1/meta/apply_blueprint.py b/authentik/blueprints/v1/meta/apply_blueprint.py index a825cb53f..5946342a3 100644 --- a/authentik/blueprints/v1/meta/apply_blueprint.py +++ b/authentik/blueprints/v1/meta/apply_blueprint.py @@ -31,7 +31,7 @@ class ApplyBlueprintMetaSerializer(PassiveSerializer): required = attrs["required"] instance = BlueprintInstance.objects.filter(**identifiers).first() if not instance and required: - raise ValidationError("Required blueprint does not exist") + raise ValidationError({"identifiers": "Required blueprint does not exist"}) self.blueprint_instance = instance return super().validate(attrs) diff --git a/authentik/core/api/tokens.py b/authentik/core/api/tokens.py index 7caabb9dd..e3c2d46bf 100644 --- a/authentik/core/api/tokens.py +++ b/authentik/core/api/tokens.py @@ -47,7 +47,7 @@ class TokenSerializer(ManagedSerializer, ModelSerializer): attrs.setdefault("user", request.user) attrs.setdefault("intent", TokenIntents.INTENT_API) if attrs.get("intent") not in [TokenIntents.INTENT_API, TokenIntents.INTENT_APP_PASSWORD]: - raise ValidationError(f"Invalid intent {attrs.get('intent')}") + raise ValidationError({"intent": f"Invalid intent {attrs.get('intent')}"}) return attrs class Meta: diff --git a/authentik/core/templates/login/base_full.html b/authentik/core/templates/login/base_full.html index a12de821c..4cbf5e8dc 100644 --- a/authentik/core/templates/login/base_full.html +++ b/authentik/core/templates/login/base_full.html @@ -78,7 +78,6 @@ {% endblock %}