From ce86b20e6b34f95cd7b17dd72da8aa3287dab802 Mon Sep 17 00:00:00 2001 From: Jens L Date: Fri, 17 Nov 2023 13:52:30 +0100 Subject: [PATCH] stages/authenticator_totp: fix API validation error due to choices (#7608) --- authentik/stages/authenticator_totp/api.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/authentik/stages/authenticator_totp/api.py b/authentik/stages/authenticator_totp/api.py index df1a379f4..3baffb3ff 100644 --- a/authentik/stages/authenticator_totp/api.py +++ b/authentik/stages/authenticator_totp/api.py @@ -1,6 +1,7 @@ """AuthenticatorTOTPStage API Views""" from django_filters.rest_framework.backends import DjangoFilterBackend from rest_framework import mixins +from rest_framework.fields import ChoiceField from rest_framework.filters import OrderingFilter, SearchFilter from rest_framework.permissions import IsAdminUser from rest_framework.serializers import ModelSerializer @@ -9,12 +10,18 @@ from rest_framework.viewsets import GenericViewSet, ModelViewSet from authentik.api.authorization import OwnerFilter, OwnerPermissions from authentik.core.api.used_by import UsedByMixin from authentik.flows.api.stages import StageSerializer -from authentik.stages.authenticator_totp.models import AuthenticatorTOTPStage, TOTPDevice +from authentik.stages.authenticator_totp.models import ( + AuthenticatorTOTPStage, + TOTPDevice, + TOTPDigits, +) class AuthenticatorTOTPStageSerializer(StageSerializer): """AuthenticatorTOTPStage Serializer""" + digits = ChoiceField(choices=TOTPDigits.choices) + class Meta: model = AuthenticatorTOTPStage fields = StageSerializer.Meta.fields + ["configure_flow", "friendly_name", "digits"]