Commit b7d4be71 authored by 姜登's avatar 姜登

password

parent 177fc7c4
Pipeline #22089 passed with stage
in 3 seconds
......@@ -139,6 +139,12 @@ class UserController extends Controller {
if (input_params.password !== input_params.confirm_password) {
ctx.throw(400, '两次输入密码不一致');
}
const user = await service.user.findOne('Account', { user_id: ctx.userId }, ['user_id', 'password', 'status']);
if (!user || user.password === ctx.helper.Md5(input_params.password)) {
ctx.throw(400, '与原密码一致');
}
await service.user.update({ user_id: ctx.userId }, { password: ctx.helper.Md5(input_params.password) }, 'Account');
ctx.body = { "msg": "修改成功" };
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment