From 2ea0d9aa06ba827aa5be8f58ee84cefb884583a5 Mon Sep 17 00:00:00 2001 From: Apex Liu Date: Fri, 20 Apr 2018 14:24:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=95=8C=E9=9D=A2=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E5=85=88=E7=BC=96=E8=BE=91=E4=B8=80=E4=B8=AA=E7=94=A8=E6=88=B7?= =?UTF-8?q?=EF=BC=88=E5=8D=B3=E4=BD=BF=E4=B8=8D=E4=BF=9D=E5=AD=98=EF=BC=89?= =?UTF-8?q?=EF=BC=8C=E7=84=B6=E5=90=8E=E6=89=A7=E8=A1=8C=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E7=94=A8=E6=88=B7=EF=BC=8C=E5=88=99=E5=88=9A=E5=88=9A=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E7=9A=84=E7=94=A8=E6=88=B7=E7=9A=84=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=BC=9A=E8=A2=AB=E6=9B=BF=E6=8D=A2=E6=88=90=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9A=84=E4=BF=A1=E6=81=AF=EF=BC=8C=E8=80=8C?= =?UTF-8?q?=E5=B9=B6=E6=B2=A1=E6=9C=89=E6=96=B0=E7=94=A8=E6=88=B7=E8=A2=AB?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/www/teleport/static/js/user/user-list.js | 1 + server/www/teleport/webroot/app/model/user.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/www/teleport/static/js/user/user-list.js b/server/www/teleport/static/js/user/user-list.js index dff2f34..65f0719 100644 --- a/server/www/teleport/static/js/user/user-list.js +++ b/server/www/teleport/static/js/user/user-list.js @@ -789,6 +789,7 @@ $app.create_dlg_edit_user = function () { if (_.isUndefined(user)) { dlg.dom.dlg_title.html('创建用户账号'); + dlg.field_id = -1; dlg.dom.edit_username.val(''); dlg.dom.edit_surname.val(''); diff --git a/server/www/teleport/webroot/app/model/user.py b/server/www/teleport/webroot/app/model/user.py index 5eb53f2..e725e91 100644 --- a/server/www/teleport/webroot/app/model/user.py +++ b/server/www/teleport/webroot/app/model/user.py @@ -267,7 +267,7 @@ def update_user(handler, args): db = get_db() # 1. 判断此账号是否已经存在 - sql = 'SELECT `username` FROM {dbtp}user WHERE id={dbph};'.format(dbtp=db.table_prefix, dbph=db.place_holder) + sql = 'SELECT `username` FROM {dbtp}user WHERE `id`={dbph};'.format(dbtp=db.table_prefix, dbph=db.place_holder) db_ret = db.query(sql, (args['id'], )) if db_ret is None or len(db_ret) == 0: return TPE_NOT_EXISTS @@ -275,7 +275,7 @@ def update_user(handler, args): old_username = db_ret[0][0] if old_username != args['username']: # 如果要更新用户登录名,则需要判断是否已经存在了 - sql = 'SELECT `id` FROM {dbtp}user WHERE username={dbph};'.format(dbtp=db.table_prefix, dbph=db.place_holder) + sql = 'SELECT `id` FROM {dbtp}user WHERE `username`={dbph};'.format(dbtp=db.table_prefix, dbph=db.place_holder) db_ret = db.query(sql, (args['username'],)) if db_ret is not None and len(db_ret) > 0: return TPE_EXISTS