Skip to content

Instantly share code, notes, and snippets.

@Adrek
Forked from Klerith/password-property-dto.ts
Created August 20, 2022 15:50
Show Gist options
  • Save Adrek/fa136387b57f4c54d1733e3d1cb77711 to your computer and use it in GitHub Desktop.
Save Adrek/fa136387b57f4c54d1733e3d1cb77711 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