|
@@ -87,15 +87,14 @@ export class LoginService {
|
|
|
if (!role) throw new ServiceError(ErrorCode.ROLE_IS_DISABLED);
|
|
|
}
|
|
|
}
|
|
|
- // 随机密码
|
|
|
+ // 修改密码
|
|
|
async updatePwd(data: UPwdDTO, type: LoginType) {
|
|
|
let model;
|
|
|
if (type === LoginType.Admin) model = this.adminModel;
|
|
|
else model = this.userModel;
|
|
|
const user = await model.findOne({ where: { id: Equal(data.id) } });
|
|
|
if (!user) new ServiceError(ErrorCode.USER_NOT_FOUND);
|
|
|
- user.password = data.password;
|
|
|
- await user.save();
|
|
|
+ await model.update({ id: data.id }, { password: data.password });
|
|
|
}
|
|
|
|
|
|
// 需要改的时候再用
|