Password Match & Strength Validation Plugin For jQuery

File Size:3.92 KB
Views Total:348
Last Update:December 25, 2017
Publish Date:December 25, 2017
Official Website:Go to website

Password validation create in jquery.  jQuery plugin is show validates the strength of a password & provides message whether the password meets the requirements you specify. it is lightweight password validation & strength jquery plugin in jquery.

How It Use : 

1. Use and include the files JQuery Links

<script src="//"></script>
<script src="jquery.password-validation.js"></script>

2. Use and include the files Html :

<input id="myPassword" type="password">
<input id="myConfirmPassword" type="password">
<div id="errors"></div>

3. Include jquery Plugin Script :

$("#myPassword").passwordValidation({"confirmField": "#myConfirmPassword"}, function(element, valid, match, failedCases) {
  $("#errors").html("<pre>" + failedCases.join("\n") + "</pre>");
   if(valid) $(element).css("border","2px solid green");
   if(!valid) $(element).css("border","2px solid red");
   if(valid && match) $("#myConfirmPassword").css("border","2px solid green");
   if(!valid || !match) $("#myConfirmPassword").css("border","2px solid red");

4. Default Validation in Plugin :


  // Minimum Length of password 
  minLength: 12,      

  // Minimum number of Upper Case Letters characters in password
  minUpperCase: 2,    

  // Minimum number of Lower Case Letters characters in password
  minLowerCase: 2,    

  // Minimum number of digits characters in password
  minDigits: 2,     

  // Minimum number of special characters in password
  minSpecial: 2,      

  // Maximum number of repeated alphanumeric characters in password dhgurAAAfjewd <- 3 A's
  maxRepeats: 5,      

  // Maximum number of alphanumeric characters from one set back to back
  maxConsecutive: 3,    

  // Disallow Upper Case Lettera
  noUpper: false,     

  // Disallow Lower Case Letters
  noLower: false,     

  // Disallow Digits
  noDigit: false,     

  // Disallow Special Characters
  noSpecial: false,   

  // Disallow user to have x number of repeated alphanumeric characters ex.. ..A..a..A.. <- fails if maxRepeats <= 3 CASE INSENSITIVE
  failRepeats: true,  

  // Disallow user to have x number of consecutive alphanumeric characters from any set ex.. abc <- fails if maxConsecutive <= 3  
  failConsecutive: true,

  // selector of confirm field
  confirmField: undefined

Done 🙂