Skip to content

Instantly share code, notes, and snippets.

@felipejoq
Forked from Klerith/password-property-dto.ts
Created January 20, 2024 13:29
Show Gist options
  • Save felipejoq/316c6bab9c23d0ae5501624ed2d319aa to your computer and use it in GitHub Desktop.
Save felipejoq/316c6bab9c23d0ae5501624ed2d319aa 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