|
@@ -40,14 +40,14 @@ class LoginController extends Controller {
|
|
|
return;
|
|
|
}
|
|
|
const res = await this.model.findOne({ userName });
|
|
|
- // 密码
|
|
|
- const pwd = sm3(`${password}:${res.salt}`);
|
|
|
if (!res) {
|
|
|
this.ctx.body = { errcode: -1001, errmsg: '用户不存在', data: '' };
|
|
|
return;
|
|
|
}
|
|
|
+ // 密码
|
|
|
+ const pwd = sm3(`${password}:${res.salt}`);
|
|
|
if (res.password !== pwd) {
|
|
|
- this.ctx.body = { errcode: -1001, errmsg: '密码错误', data: { pwd, password: res.password, salt: res.salt } };
|
|
|
+ this.ctx.body = { errcode: -1001, errmsg: '密码错误', data: '' };
|
|
|
return;
|
|
|
}
|
|
|
const token = jsonwebtoken.sign({ ...res }, jwt.secret, { expiresIn: jwt.expiresIn, issuer: jwt.issuer });
|