mirror of https://github.com/tp4a/teleport
修正:用户管理界面,如果先编辑一个用户(即使不保存),然后执行新建用户,则刚刚编辑的用户的信息会被替换成新建用户的信息,而并没有新用户被创建。
parent
69768dcc2e
commit
2ea0d9aa06
|
@ -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('');
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue