How to use the password-validator function in password-validator

To help you get started, we’ve selected a few password-validator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pearce89 / graphql-auth / server / src / app / models / User / Validation.js View on Github external
import passwordValidator from 'password-validator'
import validator from 'validator'
import _ from 'lodash'

import {
} from '~/src/app/models/User/Model'

const passwordSchema = new passwordValidator()

// .has().digits()

const passwordErrorsMessages = {
  min: 'Password should be at least 8 charachters long',
  max: 'Password should be be a maximum of 64 characters long',
  uppercase: 'Password should have uppercase characters',
  lowercase: 'Password should have lowercase characters',
  digits: 'Password should contain digits',


Validates password according to flexible and intuitive specifications

Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis

Popular password-validator functions