Check If Password Meets Complexity Requirements - passwordStrengthForcer.js

File Size: 4.16 KB
Views Total: 914
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Check If Password Meets Complexity Requirements - passwordStrengthForcer.js

passwordStrengthForcer.js is a jQuery based client-side password strength checker that lets you check if a password meets complexity requirements in an HTML form.

It allows the user to select passwords which contain the specified number of symbol, number, and upper case letters and in turn restrict weak passwords.

How to use it:

1. Load the jquery.passwordStrengthForcer.js script after jQuery.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/jquery.passwordStrengthForcer.js"></script>

2. Call the function on the password field and specify the min/max length of the password.

<input type="password" id="mypassword">

  // default: 8
  minlength: 10,

  // 0 means no max length
  maxlength: 16, 


3. Determine the password must contain digits, uppercase letters, and special characters.


  numuppercaserequired: 1,
  numdigitsrequired: 1,
  numspecialrequired: 2,


4. Customize the feedback.


  prettystatmap: {
    minlengthgood: "Minimum Length",
    maxlengthgood: "Maximum Length",
    uppercasegood: "Has Uppercase",
    digitsgood: "Has Digit",
    specialgood: "Has Special Character",
    good: '<b>good</b>',
    fail: '<b>fail</b>'


5. Apply your own styles to the password strength checker.

.passwordStrengthForcer { 
  /* CSS styles here */

6. Prevent your form from submitting until the password strength meets complexity requirements.

$('form').on('submit', function(){
  if ($('#mypassword').attr('data-passwordStrengthForcer_AllGood') != '1'){
    alert("Your password does not match complexity requirements");
    return false;

This awesome jQuery plugin is developed by relipse. For more Advanced Usages, please check the demo page or visit the official website.