perf: Translate (#13509)

Co-authored-by: feng <1304903146@qq.com>
Co-authored-by: feng626 <57284900+feng626@users.noreply.github.com>
This commit is contained in:
fit2bot
2024-06-26 15:18:37 +08:00
committed by GitHub
parent 8e87972a76
commit 40c5a218a9
9 changed files with 230 additions and 290 deletions

View File

@@ -5,7 +5,7 @@ from rest_framework import serializers
from common.serializers.fields import EncryptedField, LabeledChoiceField
from common.utils import validate_ssh_public_key
from .user import UserSerializer
from ..models import User
from ..models import User, MFAMixin
class UserOrgSerializer(serializers.Serializer):
@@ -88,18 +88,13 @@ class UserRoleSerializer(serializers.Serializer):
class UserProfileSerializer(UserSerializer):
MFA_LEVEL_CHOICES = (
(0, _('Off')),
(1, _('On')),
(2, _("Forced enabled")),
)
public_key_comment = serializers.CharField(
source='get_public_key_comment', required=False, read_only=True, max_length=128
)
public_key_hash_md5 = serializers.CharField(
source='get_public_key_hash_md5', required=False, read_only=True, max_length=128
)
mfa_level = LabeledChoiceField(choices=MFA_LEVEL_CHOICES, label=_("MFA"), required=False)
mfa_level = LabeledChoiceField(choices=MFAMixin.MFA_LEVEL_CHOICES, label=_("MFA"), required=False)
guide_url = serializers.SerializerMethodField()
receive_backends = serializers.ListField(child=serializers.CharField(), read_only=True)
console_orgs = UserOrgSerializer(many=True, read_only=True)