From 525538e775295126de982c92d0169067654890c0 Mon Sep 17 00:00:00 2001 From: feng626 <1304903146@qq.com> Date: Mon, 16 May 2022 17:28:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E5=AF=86=E9=92=A5=E7=BF=BB=E8=AF=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/serializers/base.py | 8 ++++++-- apps/users/serializers/user.py | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/assets/serializers/base.py b/apps/assets/serializers/base.py index 7c8760562..841ebeaae 100644 --- a/apps/assets/serializers/base.py +++ b/apps/assets/serializers/base.py @@ -32,8 +32,12 @@ class AuthSerializer(serializers.ModelSerializer): class AuthSerializerMixin(serializers.ModelSerializer): - password = EncryptedField(required=False, allow_blank=True, allow_null=True, max_length=1024) - private_key = EncryptedField(required=False, allow_blank=True, allow_null=True, max_length=4096) + password = EncryptedField( + label=_('Password'), required=False, allow_blank=True, allow_null=True, max_length=1024 + ) + private_key = EncryptedField( + label=_('SSH private key'), required=False, allow_blank=True, allow_null=True, max_length=4096 + ) passphrase = serializers.CharField( allow_blank=True, allow_null=True, required=False, max_length=512, write_only=True, label=_('Key password') diff --git a/apps/users/serializers/user.py b/apps/users/serializers/user.py index b1a9cf1d4..98abb47a6 100644 --- a/apps/users/serializers/user.py +++ b/apps/users/serializers/user.py @@ -88,7 +88,9 @@ class UserSerializer(RolesSerializerMixin, CommonBulkSerializerMixin, serializer can_public_key_auth = serializers.ReadOnlyField( source='can_use_ssh_key_login', label=_('Can public key authentication') ) - password = EncryptedField(required=False, allow_blank=True, allow_null=True, max_length=1024) + password = EncryptedField( + label=_('Password'), required=False, allow_blank=True, allow_null=True, max_length=1024 + ) # Todo: 这里看看该怎么搞 # can_update = serializers.SerializerMethodField(label=_('Can update')) # can_delete = serializers.SerializerMethodField(label=_('Can delete'))