1.0.9 • Published 2 years ago

password-strength-bars v1.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

PasswordStrengthBars

A React module to render colored bars based on password strength

Example

The modules takes password as an prop and checks following rules on it

1. hasDigits = (string) => /\d/.test(string);
2. hasUppercase = (string) => /[A-Z]/.test(string);
3. hasLowercase = (string) => /[a-z]/.test(string);
4. hasEightLength = (string) => (string.length >= 8 ? true : false);
5. hasSpecialCharacter = (string) =>
   /._[/!`~\_;'+=@#$%^&_()\]\\,.?":{}|<>-]/.test(string);

Password is categorized into 4 types.

  1. Strong: If all above rules are passed, password will be declared as Strong and all 4 bars will get Green
  2. Good: If any 1 of the rules failed password will be declared as Good and 3 of the bars will get Blue
  3. Normal: If any 2 of the rules failed password will be declared as Normal and 2 of the bars will get Orange
  4. Weak: If any 3 of the rules failed password will be declared as Weak and 1 of the bars will get Red

Installation

npm install password-strength-bars or yarn add password-strength-bars

Usage

import PasswordStrengthBar from "password-strength-bars";
<PasswordStrengthBar password={"SamplePass123!"} />

Props

NameTypeDefaultDescription
passwordString""password for which modules will check the strength and will render bars (lines)
containerClassString""Container className to modify any style
showTitleBooleantrueIf password title need to be shown below the bars
strengthTitlesObject{ weak: "Weak",normal: "Normal", good: "Good", strong: "Strong"}You can mofify title of the password by passing strengthTitles object
1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago