Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mikecobas/5882b2f90004c807b24266e664b0ff41 to your computer and use it in GitHub Desktop.
Save mikecobas/5882b2f90004c807b24266e664b0ff41 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