check-password-strength
Password strength checker based from Javascript RegExp
Last updated 5 months ago by dvincent333 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install check-password-strength 
SYNC missed versions from official npm registry.

Overview

A simple way to check that password strength of a certain passphrase. A password strength checker based from Javascript RegEx.

Build Status

Installation

npm i check-password-strength --save

Setup & Basic Usage

const passwordStrength = require('check-password-strength')

console.log(passwordStrength('asdfasdf').value)
// Weak (It wiill return weak if the value doesn't match the RegEx conditions)

console.log(passwordStrength('Asdfasdf2020').value)
// Medium

console.log(passwordStrength('A@2asdF2020!!*').value)
// Strong

Additional Info

Object

Property Desc.
id 0 = Weak, 1 = Medium & 2 = Strong
value Weak, Medium & Strong
console.log(passwordStrength('Asdfasdf2020'))
// { id: 1, "value": "Medium" }

RegEx

Strong Password RegEx used:

^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})

Medium Password RegEx used:

^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})"

RegEx Desc.
^ The password string will start this way
(?=.*[a-z]) The string must contain at least 1 lowercase alphabetical character
(?=.*[A-Z]) The string must contain at least 1 uppercase alphabetical character
(?=.*[0-9]) The string must contain at least 1 numeric character
(?=.[!@#$%^&]) The string must contain at least one special character, but we are escaping reserved RegEx characters to avoid conflict
(?=.{8,}) The string must be eight characters or longer

Credits to Nic Raboy for his awesome blog!

Feel free to clone or fork this project: https://github.com/deanilvincent/check-password-strength.git

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Current Tags

  • 1.0.8                                ...           latest (4 months ago)

8 Versions

  • 1.0.8                                ...           4 months ago
  • 1.0.7                                ...           4 months ago
  • 1.0.6                                ...           5 months ago
  • 1.0.5                                ...           5 months ago
  • 1.0.4                                ...           5 months ago
  • 1.0.3                                ...           5 months ago
  • 1.0.2                                ...           5 months ago
  • 1.0.1                                ...           5 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2017 © taobao.org |