class-validator-password-check
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

class-validator-password-check

Password Validator using class-validator

Installation

Module installation

$ npm install class-validator-password-check --save
$ yarn add class-validator-password-check

(or the short way):

npm i -S class-transformer-validator

Peer dependencies

This package is only a simple plugin/wrapper, so you have to install the required modules too because it can't work without them. See detailed installation instruction for the modules installation:

import { PasswordValidation, PasswordValidationRequirement } from 'class-validator-password-check'
 
var passwordRequirement: PasswordValidationRequirement = {
    mustContainLowerLetter: true,
    mustContainNumber: true,
    mustContainSpecialCharacter: true,
    mustContainUpperLetter: true
}
 
export class UserRegisterDto {
 
    @IsString()
    @MinLength(6)
    @MaxLength(20)
    @Validate(PasswordValidation, [passwordRequirement])
    readonly password: string;
    
}

Todos

  • Add minimium length
  • Make special character dynamic

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i class-validator-password-check

Weekly Downloads

968

Version

1.0.8

License

ISC

Unpacked Size

25 kB

Total Files

18

Last publish

Collaborators

  • thecoderefiner