From 306193ca5f52368ca1009afd382ea5036345b699 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 14 Feb 2023 16:53:10 +0800 Subject: [PATCH] perf: input_secret (#9542) Co-authored-by: feng <1304903146@qq.com> --- ...0018_alter_connectiontoken_input_secret.py | 19 +++++++++++++++++++ .../authentication/models/connection_token.py | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 apps/authentication/migrations/0018_alter_connectiontoken_input_secret.py diff --git a/apps/authentication/migrations/0018_alter_connectiontoken_input_secret.py b/apps/authentication/migrations/0018_alter_connectiontoken_input_secret.py new file mode 100644 index 000000000..b11598066 --- /dev/null +++ b/apps/authentication/migrations/0018_alter_connectiontoken_input_secret.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.16 on 2023-02-14 08:49 + +import common.db.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('authentication', '0017_auto_20230105_1743'), + ] + + operations = [ + migrations.AlterField( + model_name='connectiontoken', + name='input_secret', + field=common.db.fields.EncryptTextField(blank=True, default='', max_length=64, verbose_name='Input secret'), + ), + ] diff --git a/apps/authentication/models/connection_token.py b/apps/authentication/models/connection_token.py index 958ab8fa9..99a55616e 100644 --- a/apps/authentication/models/connection_token.py +++ b/apps/authentication/models/connection_token.py @@ -10,7 +10,7 @@ from django.utils.translation import ugettext_lazy as _ from rest_framework.exceptions import PermissionDenied from assets.const import Protocol -from common.db.fields import EncryptCharField +from common.db.fields import EncryptTextField from common.exceptions import JMSException from common.utils import lazyproperty, pretty_string, bulk_get from common.utils.timezone import as_current_tz @@ -34,7 +34,7 @@ class ConnectionToken(JMSOrgBaseModel): ) account = models.CharField(max_length=128, verbose_name=_("Account name")) # 登录账号Name input_username = models.CharField(max_length=128, default='', blank=True, verbose_name=_("Input username")) - input_secret = EncryptCharField(max_length=64, default='', blank=True, verbose_name=_("Input secret")) + input_secret = EncryptTextField(max_length=64, default='', blank=True, verbose_name=_("Input secret")) protocol = models.CharField(max_length=16, default=Protocol.ssh, verbose_name=_("Protocol")) connect_method = models.CharField(max_length=32, verbose_name=_("Connect method")) user_display = models.CharField(max_length=128, default='', verbose_name=_("User display"))