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