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"]