fix: 修复密码密钥翻译问题

pull/8244/head^2
feng626 2022-05-16 17:28:02 +08:00 committed by Jiangjie.Bai
parent 2a8f8dd709
commit 525538e775
2 changed files with 9 additions and 3 deletions

View File

@ -32,8 +32,12 @@ class AuthSerializer(serializers.ModelSerializer):
class AuthSerializerMixin(serializers.ModelSerializer): class AuthSerializerMixin(serializers.ModelSerializer):
password = EncryptedField(required=False, allow_blank=True, allow_null=True, max_length=1024) password = EncryptedField(
private_key = EncryptedField(required=False, allow_blank=True, allow_null=True, max_length=4096) 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( passphrase = serializers.CharField(
allow_blank=True, allow_null=True, required=False, max_length=512, allow_blank=True, allow_null=True, required=False, max_length=512,
write_only=True, label=_('Key password') write_only=True, label=_('Key password')

View File

@ -88,7 +88,9 @@ class UserSerializer(RolesSerializerMixin, CommonBulkSerializerMixin, serializer
can_public_key_auth = serializers.ReadOnlyField( can_public_key_auth = serializers.ReadOnlyField(
source='can_use_ssh_key_login', label=_('Can public key authentication') 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: 这里看看该怎么搞 # Todo: 这里看看该怎么搞
# can_update = serializers.SerializerMethodField(label=_('Can update')) # can_update = serializers.SerializerMethodField(label=_('Can update'))
# can_delete = serializers.SerializerMethodField(label=_('Can delete')) # can_delete = serializers.SerializerMethodField(label=_('Can delete'))