update password
This commit is contained in:
@@ -203,16 +203,6 @@ export class AuthService {
|
||||
throw new UnauthorizedException('User not found');
|
||||
}
|
||||
|
||||
if (user.passwordHash) {
|
||||
if (!dto.currentPassword) {
|
||||
throw new BadRequestException('Current password is required');
|
||||
}
|
||||
const valid = await verifyPassword(dto.currentPassword, user.passwordHash);
|
||||
if (!valid) {
|
||||
throw new UnauthorizedException('Current password is incorrect');
|
||||
}
|
||||
}
|
||||
|
||||
user.passwordHash = await hashPassword(dto.password);
|
||||
const saved = await this.users.save(user);
|
||||
return serializeUser(saved);
|
||||
|
||||
Reference in New Issue
Block a user