修正:修改密码会失败的问题。

pull/32/head v2.2.6.1-hotfix-2
Apex Liu 2017-04-19 18:44:07 +08:00
parent 32e0991164
commit 94aebc3277
2 changed files with 49 additions and 48 deletions

View File

@ -142,18 +142,19 @@ class ModifyPwd(TPBaseUserAuthJsonHandler):
if args is not None: if args is not None:
args = json.loads(args) args = json.loads(args)
else: else:
self.write_json(-1) self.write_json(-11)
return return
_old_pwd = args['o_pwd'] _old_pwd = args['o_pwd']
_new_pwd = args['n_pwd'] _new_pwd = args['n_pwd']
if _old_pwd is None or _new_pwd is None: if _old_pwd is None or _new_pwd is None:
self.write_json(-1) self.write_json(-12)
return return
user_info = self.get_current_user() user_info = self.get_current_user()
try: try:
ret = user.modify_pwd(_old_pwd, _new_pwd, user_info['id']) ret = user.modify_pwd(_old_pwd, _new_pwd, user_info['id'])
self.write_json(0, ret) self.write_json(ret)
except: except:
self.write_json(-1) log.e('modify password failed.')
self.write_json(-13)

View File

@ -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}, ywl.ajax_post_json('/auth/modify-pwd', {o_pwd: old_pwd, n_pwd: new_pwd_1, callback: 1},
function (ret) { function (ret) {
if (ret.data.code == 0) { if (ret.code == 0) {
ywl.notify_success('密码修改成功!'); ywl.notify_success('密码修改成功!');
ywl.clear_input(); ywl.clear_input();
} else if (ret.data.code == -2) { } else if (ret.code == -2) {
ywl.notify_error('密码错误!'); ywl.notify_error('密码错误!');
} else { } else {
ywl.notify_error('密码修改失败!'); ywl.notify_error('密码修改失败!errcode:'+ret.code);
} }
}, },