29 lines
861 B
TypeScript
29 lines
861 B
TypeScript
import { IsString, MinLength, MaxLength, Matches } from 'class-validator';
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|
|
|
export class ResetPasswordDto {
|
|
@ApiProperty({
|
|
example: 'abc123token',
|
|
description: 'Password reset token from email',
|
|
})
|
|
@IsString()
|
|
token: string;
|
|
|
|
@ApiProperty({
|
|
example: 'NewPassword@123',
|
|
description: 'New password (min 8 chars, 1 uppercase, 1 lowercase, 1 number, 1 special char)',
|
|
minLength: 8,
|
|
})
|
|
@IsString()
|
|
@MinLength(8, { message: 'Password must be at least 8 characters long' })
|
|
@MaxLength(50, { message: 'Password must not exceed 50 characters' })
|
|
@Matches(
|
|
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]/,
|
|
{
|
|
message:
|
|
'Password must contain at least 1 uppercase, 1 lowercase, 1 number, and 1 special character',
|
|
},
|
|
)
|
|
password: string;
|
|
}
|