Skip to content

Commit

Permalink
stages/authenticator_totp: fix API validation error due to choices (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
BeryJu authored Nov 17, 2023
1 parent a48ccbc commit ce86b20
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion authentik/stages/authenticator_totp/api.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,12 +10,18 @@
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"]
Expand Down

0 comments on commit ce86b20

Please sign in to comment.