HM-129. Правки ошибки не верного старого пароля
This commit is contained in:
@ -248,7 +248,10 @@ export class UserService {
|
||||
throw new BadRequestException('Запрещено менять пароль пользователя admin');
|
||||
}
|
||||
const user = await this.userModel().findOne({login});
|
||||
if (user && await this.checkPassword(old_password, user.password)) {
|
||||
if (!await this.checkPassword(old_password, user.password)) {
|
||||
throw new BadRequestException('Не верный старый пароль');
|
||||
}
|
||||
if (user) {
|
||||
const salt = user.salt;
|
||||
const password = await bcrypt.hash(new_password, salt);
|
||||
await user.updateOne({
|
||||
|
||||
Reference in New Issue
Block a user