This time I will share jQuery Plugin and tutorial about Slim Password Strength Meter Plugin For jQuery, hope it will help you in programming stack.
Just another Password Strength Meter built with jQuery that visualizes the strength of a password your user enters into a password field.
Key Features:
- Displays a password strength indicator below the password field.
- Custom error short/bad/good/strong messages.
- Custom events supported.
- Licensed under a GPL 3.0 license.
Installation:
2 |
$ npm install password-strength-meter |
5 |
$ bower install password-strength-meter |
How to use it:
1. Load the Password Strength Meter’s JavaScript and CSS files in the webpage which has jQuery library loaded.
1 |
< script src = "//code.jquery.com/jquery.min.js" ></ script > |
2 |
< link rel = "stylesheet" href = "password.css" > |
3 |
< script src = "password.js" ></ script > |
2. Call the main function password()
on the password input field and done.
1 |
$( '#YOUR-PASSWORD' ).password(); |
3. Config the Password Strength Meter with the following options.
01 |
$( '#password' ).password({ |
04 |
enterPass: 'Type your password' , |
05 |
shortPass: 'The password is too short' , |
06 |
containsField: 'The password contains your username' , |
08 |
13: 'Really insecure password' , |
09 |
33: 'Weak; try combining letters & numbers' , |
10 |
67: 'Medium; try using special characters' , |
11 |
94: 'Strong password' , |
28 |
fieldPartialMatch: true , |
34 |
closestSelector: 'div' , |
37 |
useColorBarImage: false , |
4. Custom events.
01 |
$( '#events' ).password().on( 'password.score' , function (e, score) { |
03 |
$( '#submit' ).removeAttr( 'disabled' ); |
05 |
$( '#submit' ).attr( 'disabled' , true ); |
09 |
$( '#events' ).on( 'password.text' , (e, text, score) => { |
11 |
console.log( 'Current message is %s with a score of %d' , text, score) |
Changelog:
v2.1.0 (2020-03-24)
- Custom steps
- Custom color bar
- Allow setting closest selector (to add compatibility to any css framework, like bootstrap)
- Other minor fixes
2019-05-25
- v1.2.2: Added ‘closestSelector’ option.
This awesome jQuery plugin is developed by elboletaire. For more Advanced Usages, please check the demo page or visit the official website.