fix: 调整confirm (#8554)

Co-authored-by: feng626 <1304903146@qq.com>
pull/8556/head
fit2bot 2022-07-07 17:07:57 +08:00 committed by GitHub
parent 1b4d389f2b
commit bf7c05f753
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -18,7 +18,9 @@ class ConfirmType(TextChoices):
@classmethod
def get_can_confirm_types(cls, confirm_type):
start = cls.values.index(confirm_type)
return cls.values[start:]
types = cls.values[start:]
types.reverse()
return types
@classmethod
def get_can_confirm_backend_classes(cls, confirm_type):

View File

@ -7,4 +7,4 @@ from ..const import ConfirmType, MFAType
class ConfirmSerializer(serializers.Serializer):
confirm_type = serializers.ChoiceField(required=True, allow_blank=True, choices=ConfirmType.choices)
mfa_type = serializers.ChoiceField(required=False, allow_blank=True, choices=MFAType.choices)
secret_key = EncryptedField()
secret_key = EncryptedField(allow_blank=True)

View File

@ -33,7 +33,7 @@ class WithBootstrapToken(permissions.BasePermission):
class UserConfirmation(permissions.BasePermission):
ttl = 300
ttl = 60 * 5
min_level = 1
confirm_type = ConfirmType.ReLogin