Checking Password Strength with pStrength jQuery Plugin

pStrength plugin - web design - Password Strength

the easiest way to check password strength in web design using pStrength plugin



Checking Password Strength with pStrength jQuery Plugin

When we make a web design, we often make registration form for the visitor. One of the field is password.
One thing we need is password strength to ensure the better security for login access..

To fulfill that we can use pStrength jQuery Plugin.
We just need to enter these lines below in our HTML code:

<script src="jquery-1.10.2.min.js"></script>	
<script type="text/javascript" src="pStrength.jquery.js"></script>

Then we can write jquery statement like below:

Read: 7 Reasons To Learn MySQL For Web Programming
$(document).ready(function(){
    
            $('#password').pStrength({
                'changeBackground': false,
                'onPasswordStrengthChanged' : function(passwordStrength, strengthPercentage) {
                    if ($(this).val()) {
                        $.fn.pStrength('changeBackground', this, passwordStrength);
                    } else {
                        $.fn.pStrength('resetStyle', this);
                    }
                    $('#' + $(this).data('display')).html('Password Strength: ' + strengthPercentage + '%');
                    
                    if(strengthPercentage < 60)
	                    	{
	                    		$('button[type=submit]').attr('disabled', 'disabled');
	    						$('form').bind('submit',function(e){e.preventDefault();});
	                    	}
	                    else
	                    	{
	                    		$('button[type=submit]').removeAttr('disabled', 'disabled');
	    						$('form').unbind('submit');
	                    	}
                },
                'onValidatePassword': function(strengthPercentage) {
                    $('#' + $(this).data('display')).html(
                        $('#' + $(this).data('display')).html() + ' Great!'
                    );
                }
            });
        });

From above example we can see the part as follows:

Read: 7 Reasons To Learn MySQL For Web Programming
if(strengthPercentage < 60)
	{
		$('button[type=submit]').attr('disabled', 'disabled');
		$('form').bind('submit',function(e){e.preventDefault();});
	}
else
	{
		$('button[type=submit]').removeAttr('disabled', 'disabled');
		$('form').unbind('submit');
	}

It is used to prevent form submitting if Password Strength is less than 60.

You can check the demo site below:

DEMO



Related Article

Web Design Services - Best Webdesign - Best SEO Services

Restricted input type for number only by using HTML5

How to make the input type to be valid for number only? We do not need to use javascript, because we can do that easily with HTML5. Let say we want to make an input type for temperature with the following rule: minimum 30o and maximum 50o, but allow ...


4 Ways to Optimize MySQL Database

Database optimization is a way to improve performance. You will make an effort to improve the data structure, index, and query. In an optimization process, speed from a transaction becomes a repair focus. Thus, an optimization process is crucial beca ...


What Is MySQL: The Definition and Functions

MySQL is an open-source system of database management using basic commands or a programming language with structured query language. It is fairly popular in the technology world. MySQL is useful as a database. It has been used by more than 60 million ...


Working Process

Web Design - Wedding Photography - Wedding Videography

Our Location at Surabaya and Bali

Website Design in Indonesia

Graphic Design in Indonesia

Contact

+628113638531 / +628113865464

info@tatamedia.com

Webdesigner in Indonesia

Videographer in Bali

Office

Tatamedia Solusindo Surabaya

Dekkophotography Bali

Fine Art Photography in Bali

Web Design

Support

Send your request to

info@tatamedia.com