chore: change password

This commit is contained in:
xiaojunnuo
2023-06-28 23:15:37 +08:00
parent f5493c542b
commit 2bcab76f5a
7 changed files with 177 additions and 9 deletions
@@ -142,4 +142,17 @@ export class UserService extends BaseService<UserEntity> {
delete newUser.password;
return newUser;
}
async changePassword(userId: any, form: any) {
const user = await this.info(userId);
if (!this.checkPassword(form.password, user.password)) {
throw new CommonException('原密码错误');
}
const param = {
id: userId,
password: form.newPassword,
};
await this.update(param);
}
}