Choose Strong Password, Validate password contain specific requirements

Validate password contain

In this tutorial I am going to share awesome jQuery Plugin – Pass Requirements Which along along with your adherent to select hermetic Validate password contain and force fanatic to fulfil sure password requirements. This jQuery plugin lists a set of requirements for an input auditorium and crosses them out as the input matches each requirement. Good for password hints.moreover you can set usernames bearing in mind special requirements,etc.

Creating Input field which meets certain requirements with hints popup

Libraries

The plugin dependent on the subject of the order of the order of jquery and bootstrap library hence load dependent libraries first subsequently mount happening passRequirements.js upon page.

<!--CSS-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
 
<!--JS-->
<script src="//code.jquery.com/jquery-latest.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="PassRequirements.js"></script>

HTML

Here i am going to make basic input arena subsequent to default requirements.

<input id="pass">

JS

Very basic use of this plugin just call the do something upon page to use default requirements.

$(function() {   
 $('#pass').PassRequirements();
});

Here is the list of options you can toting uphill in input ground to set customize input requirements. Good for creating password hits and force user to pick strongest password.

$(function() {   
 $('#pass').PassRequirements({
        rules: {
            containSpecialChars: {
                text: "Your input should contain at least minLength special character",
                minLength: 1,
                regex: new RegExp('([^!,%,&,@,#,$,^,*,?,_,~])', 'g')
            },
            containNumbers: {
                text: "Your input should contain at least minLength numbers",
                minLength: 2,
                regex: new RegExp('[^0-9]', 'g')
            }
        },
        popoverPlacement: 'top',
        defaults: false,
        trigger: 'click'
    });
});

Leave a Reply