Skip to content Skip to sidebar Skip to footer

Enforce Strong Password Policy With Parsley.js

I have a password field that i will like to ensure that the users input a password that will meet the criteria stated below:- Must contain at least one capital letter Must contain

Solution 1:

I think that for efficiency and maintainability you should either define a custom validator like explained here or a regex one if you're good at it (((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?(?=.*[#%@!*(()+=]))).{6,16} could do the job?);)

Solution 2:

<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/parsley.js/2.6.0/parsley.js"></script><formdata-parsley-validate><inputtype="password"name="password"id="password"minlength="6"data-parsley-type="alphanum"data-parsley-pattern="^/^[a-zA-Z0-9\-\_]$/"class="form-control allForms"requireddata-parsley-required-message="Your password"data-parsley-trigger="change focusin"placeholder="Enter password"></form>

Post a Comment for "Enforce Strong Password Policy With Parsley.js"