Skip to content

Instantly share code, notes, and snippets.

@OscarGM40
Forked from Klerith/password-property-dto.ts
Created August 25, 2022 16:00
Show Gist options
  • Save OscarGM40/8b6aea6127c421f255d7ba0802cbd0a5 to your computer and use it in GitHub Desktop.
Save OscarGM40/8b6aea6127c421f255d7ba0802cbd0a5 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