joi-password-complexity-fixed

2.0.1 • Public • Published

Joi Password Complexity

Creates a Joi object that validates password complexity.

Installation

npm install joi-password-complexity

Example

No options specified

const Joi = require('joi');
const PasswordComplexity = require('joi-password-complexity');

Joi.validate('aPassword123!', new PasswordComplexity(), (err, value) => {
  //...
})

When no options are specified, the following are used:

{
  min: 8,
  max: 26,
  lowerCase: 1,
  upperCase: 1,
  numeric: 1,
  symbol: 1,
  requirementCount: 3,
}

Options specified

const Joi = require('joi');
const PasswordComplexity = require('joi-password-complexity');

const complexityOptions = {
  min: 10,
  max: 30,
  lowerCase: 1,
  upperCase: 1,
  numeric: 1,
  symbol: 1,
  requirementCount: 2,
}

Joi.validate('aPassword123!', new PasswordComplexity(complexityOptions), (err, value) => {
  //...
})

License

MIT

Package Sidebar

Install

npm i joi-password-complexity-fixed

Weekly Downloads

1

Version

2.0.1

License

MIT

Last publish

Collaborators

  • patrickmichalina