stages/authenticator_totp: fix API validation error due to choices (#7608)
This commit is contained in:
parent
a48ccbc8a8
commit
ce86b20e6b
|
@ -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"]
|
||||
|
|
Reference in a new issue