Skip to content

Instantly share code, notes, and snippets.

@JohanAltamar
Forked from Klerith/password-property-dto.ts
Created December 13, 2024 21:28
Show Gist options
  • Save JohanAltamar/6339c8f102b1948282e2512c59d56b0d to your computer and use it in GitHub Desktop.
Save JohanAltamar/6339c8f102b1948282e2512c59d56b0d to your computer and use it in GitHub Desktop.
Password validation - DTO
@IsString()
@MinLength(6)
@MaxLength(50)
@Matches(
/(?:(?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/, {
message: 'The password must have a Uppercase, lowercase letter and a number'
})
password: string;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment