mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-27 17:14:55 +00:00
feat: add change password api
This commit is contained in:
23
src/auth/dtos/request/change-password.request.dto.ts
Normal file
23
src/auth/dtos/request/change-password.request.dto.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNotEmpty, IsString, Matches } from 'class-validator';
|
||||
import { i18nValidationMessage as i18n } from 'nestjs-i18n';
|
||||
import { PASSWORD_REGEX } from '~/auth/constants';
|
||||
|
||||
export class ChangePasswordRequestDto {
|
||||
@ApiProperty({ example: 'currentPassword@123' })
|
||||
@IsString({ message: i18n('validation.IsString', { path: 'general', property: 'auth.currentPassword' }) })
|
||||
@IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'auth.currentPassword' }) })
|
||||
currentPassword!: string;
|
||||
|
||||
@ApiProperty({ example: 'Abcd1234@' })
|
||||
@Matches(PASSWORD_REGEX, {
|
||||
message: i18n('validation.Matches', { path: 'general', property: 'auth.newPassword' }),
|
||||
})
|
||||
newPassword!: string;
|
||||
|
||||
@ApiProperty({ example: 'Abcd1234@' })
|
||||
@Matches(PASSWORD_REGEX, {
|
||||
message: i18n('validation.Matches', { path: 'general', property: 'auth.confirmNewPassword' }),
|
||||
})
|
||||
confirmNewPassword!: string;
|
||||
}
|
||||
Reference in New Issue
Block a user