From 94aaa336115a547681a9cd0d05b7716b98a5c200 Mon Sep 17 00:00:00 2001 From: chenzuoqing Date: Wed, 22 Dec 2021 18:17:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E5=87=BA=E9=9C=80=E8=A6=81=E5=8A=A0?= =?UTF-8?q?=E5=AF=86=E5=AD=97=E6=AE=B5=E7=9A=84=E8=A7=86=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/asset/views.py | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/controller/asset/views.py b/src/controller/asset/views.py index 2671e53..43262fd 100644 --- a/src/controller/asset/views.py +++ b/src/controller/asset/views.py @@ -13,7 +13,6 @@ from common.permission import session_or_token_required from common.utils import abort_response from controller.asset import parsers from common.crypto import quick_crypto -from settings.common import SECRET_KEY logger = logging.getLogger("views") @@ -64,14 +63,6 @@ class MySQLInstanceViews(parsers.DatabaseServerParse, ListMixin, EncryptRequired self.request_parse.add_argument("core", required=True, type=int, location='json') super(MySQLInstanceViews, self).__init__() - def pre_create(self, args): - """加密保存密码,若提交了密码,必须加密存储""" - args = super().pre_create(args) - if "password" in args: - password = args.get("password") - args["password"] = quick_crypto(password) - return args - class MySQLInstanceDetail(parsers.DatabaseServerParse, RetrieveMixin, DestroyMixin, EncryptRequiredUpdateView): model = assetModel.MySQLInstance @@ -94,15 +85,6 @@ class MySQLInstanceDetail(parsers.DatabaseServerParse, RetrieveMixin, DestroyMix self.request_parse.add_argument("core", required=False, type=int, location='json') super(MySQLInstanceDetail, self).__init__() - def pre_update(self, obj: assetModel.MySQLInstance, args: dict): - """加密保存密码,若提交了密码,必须加密存储""" - data = super().pre_update(obj, args) - if "password" in data: - password = data.get("password") - if password != obj.password: - data["password"] = quick_crypto(password) - return data - class DatabaseViews(parsers.DatabaseParse, Resource): model = assetModel.DatabaseServer @@ -220,14 +202,6 @@ class RedisInstanceViews(parsers.DatabaseServerParse, ListMixin, EncryptRequired self.request_parse.add_argument("replicas", required=False, type=int, location='json') super(RedisInstanceViews, self).__init__() - def pre_create(self, args): - """加密保存密码,若提交了密码,必须加密存储""" - args = super().pre_create(args) - if "password" in args: - password = args.get("password") - args["password"] = quick_crypto(password) - return args - class RedisInstanceDetail(parsers.DatabaseServerParse, DestroyMixin, RetrieveMixin, EncryptRequiredUpdateView): model = assetModel.RedisInstance