正在显示
2 个修改的文件
包含
10 行增加
和
3 行删除
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | #email: nheweijun@sina.com |
5 | 5 | import datetime |
6 | 6 | from ..models import Database,db,Table,Columns,TableVacuate,DES |
7 | +from app.models import AESHelper | |
7 | 8 | |
8 | 9 | import uuid |
9 | 10 | from . import database_test |
... | ... | @@ -31,7 +32,9 @@ class Api(ApiTemplate): |
31 | 32 | database = self.para.get("database") |
32 | 33 | encryption = int(self.para.get("encryption","0")) |
33 | 34 | if encryption: |
34 | - passwd = DES.decode(passwd) | |
35 | + # passwd = DES.decode(passwd) | |
36 | + passwd = AESHelper.decode(passwd) | |
37 | + | |
35 | 38 | |
36 | 39 | sqlalchemy_uri = "postgresql://{}:{}@{}:{}/{}".format(user,passwd,host,port,database) |
37 | 40 | connectsrt = "hostaddr={} port={} dbname='{}' user='{}' password='{}'".format(host,port,database,user,passwd) |
... | ... | @@ -309,6 +312,9 @@ class Api(ApiTemplate): |
309 | 312 | {"name": "alias", |
310 | 313 | "in": "formData", |
311 | 314 | "type": "string","description":"数据库别名","required": "true"}, |
315 | + {"name": "encryption", | |
316 | + "in": "formData", | |
317 | + "type": "int", "description": "密码是否加密", "enum": [0, 1]} | |
312 | 318 | ], |
313 | 319 | "responses":{ |
314 | 320 | 200:{ | ... | ... |
... | ... | @@ -7,7 +7,7 @@ from contextlib import closing |
7 | 7 | from sqlalchemy import create_engine |
8 | 8 | |
9 | 9 | from ..models import Database,db,DES |
10 | - | |
10 | +from app.models import AESHelper | |
11 | 11 | |
12 | 12 | from sqlalchemy.orm import sessionmaker |
13 | 13 | from app.util.component.ApiTemplate import ApiTemplate |
... | ... | @@ -27,7 +27,8 @@ class Api(ApiTemplate): |
27 | 27 | |
28 | 28 | encryption = int(self.para.get("encryption", "0")) |
29 | 29 | if encryption: |
30 | - passwd = DES.decode(passwd) | |
30 | + #passwd = DES.decode(passwd) | |
31 | + passwd = AESHelper.decode(passwd) | |
31 | 32 | |
32 | 33 | sqlalchemy_uri = "postgresql://{}:{}@{}:{}/{}".format(user,passwd,host,port,database) |
33 | 34 | ... | ... |
请
注册
或
登录
后发表评论