mirror of https://github.com/tp4a/teleport
parent
32e0991164
commit
94aebc3277
|
@ -142,18 +142,19 @@ class ModifyPwd(TPBaseUserAuthJsonHandler):
|
|||
if args is not None:
|
||||
args = json.loads(args)
|
||||
else:
|
||||
self.write_json(-1)
|
||||
self.write_json(-11)
|
||||
return
|
||||
_old_pwd = args['o_pwd']
|
||||
_new_pwd = args['n_pwd']
|
||||
|
||||
if _old_pwd is None or _new_pwd is None:
|
||||
self.write_json(-1)
|
||||
self.write_json(-12)
|
||||
return
|
||||
|
||||
user_info = self.get_current_user()
|
||||
try:
|
||||
ret = user.modify_pwd(_old_pwd, _new_pwd, user_info['id'])
|
||||
self.write_json(0, ret)
|
||||
self.write_json(ret)
|
||||
except:
|
||||
self.write_json(-1)
|
||||
log.e('modify password failed.')
|
||||
self.write_json(-13)
|
||||
|
|
|
@ -27,13 +27,13 @@ ywl.on_init = function (cb_stack, cb_args) {
|
|||
}
|
||||
ywl.ajax_post_json('/auth/modify-pwd', {o_pwd: old_pwd, n_pwd: new_pwd_1, callback: 1},
|
||||
function (ret) {
|
||||
if (ret.data.code == 0) {
|
||||
if (ret.code == 0) {
|
||||
ywl.notify_success('密码修改成功!');
|
||||
ywl.clear_input();
|
||||
} else if (ret.data.code == -2) {
|
||||
} else if (ret.code == -2) {
|
||||
ywl.notify_error('密码错误!');
|
||||
} else {
|
||||
ywl.notify_error('密码修改失败!');
|
||||
ywl.notify_error('密码修改失败!errcode:'+ret.code);
|
||||
}
|
||||
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue