update : password

This commit is contained in:
morteza-mortezai
2025-11-12 09:16:37 +03:30
parent 0aec555ff0
commit b3f6ce05c5
3 changed files with 21707 additions and 7 deletions
+21700
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -4,11 +4,11 @@ import { IsNotEmpty, IsString, MinLength } from "class-validator";
import { AuthMessage } from "../../../common/enums/message.enum";
export class ChangePasswordDto {
@IsNotEmpty({ message: AuthMessage.PASSWORD_NOT_EMPTY })
@IsString({ message: AuthMessage.PASSWORD_FORMAT_INVALID })
@ApiProperty({ description: "old password", example: "12S345SS678" })
@MinLength(8, { message: AuthMessage.PASSWORD_LENGTH })
password: string;
// @IsNotEmpty({ message: AuthMessage.PASSWORD_NOT_EMPTY })
// @IsString({ message: AuthMessage.PASSWORD_FORMAT_INVALID })
// @ApiProperty({ description: "old password", example: "12S345SS678" })
// @MinLength(8, { message: AuthMessage.PASSWORD_LENGTH })
// password: string;
@IsNotEmpty({ message: AuthMessage.PASSWORD_NOT_EMPTY })
@IsString({ message: AuthMessage.PASSWORD_FORMAT_INVALID })
+2 -2
View File
@@ -196,8 +196,8 @@ export class AuthService {
async changePassword(userId: string, updateDto: ChangePasswordDto) {
const { user } = await this.usersService.findOneById(userId);
const passCompare = await this.passwordService.comparePassword(updateDto.password, user.password);
if (!passCompare) throw new BadRequestException(AuthMessage.CURRENT_PASSWORD_INVALID);
// const passCompare = await this.passwordService.comparePassword(updateDto.password, user.password);
// if (!passCompare) throw new BadRequestException(AuthMessage.CURRENT_PASSWORD_INVALID);
if (updateDto.newPassword !== updateDto.repeatPassword) throw new BadRequestException(AuthMessage.INVALID_REAPET_PASSWORD);