refactor: change password repository lookup (#19584)

This commit is contained in:
Jason Rasmussen
2025-06-27 16:52:04 -04:00
committed by GitHub
parent a2a9797fab
commit 09cbc5d3f4
4 changed files with 29 additions and 26 deletions

View File

@@ -91,11 +91,7 @@ export class AuthService extends BaseService {
async changePassword(auth: AuthDto, dto: ChangePasswordDto): Promise<UserAdminResponseDto> {
const { password, newPassword } = dto;
const user = await this.userRepository.getByEmail(auth.user.email, { withPassword: true });
if (!user) {
throw new UnauthorizedException();
}
const user = await this.userRepository.getForChangePassword(auth.user.id);
const valid = this.validateSecret(password, user.password);
if (!valid) {
throw new BadRequestException('Wrong password');