简体   繁体   中英

Validation for new password and confirm password

I need validation for new password and confirm password with below criteria.

Use 8 to 16 character Password should contain at least 1 numeric and 1 alphabet Special Character Password is case sensitives

 <div class="panel-body"> <div class="Container"> <span class="Heading"> Create a New Password </span> <form method="post" name="sentEmailForm" id="resetPasswordForm" action = "/reset-password?q=<?php echo $qhffj; ?>"> <div class="col-sm-12 p-0 mbottom20"> <div class="col-sm-2 p-0 left"> <label>Enter New Password</label> </div> <div class="col-sm-10 p-0 right"> <input type="password" name="password" id = "password" class="" /><br/> </div> </div> <div class="col-sm-12 p-0 mbottom20"> <div class="col-sm-2 p-0 left"> <label>Confirm Password</label> </div> <div class="col-sm-10 p-0 right"> <input type="password" name="confirmpassword" id ="confirmpassword" class="" /><br/> </div> </div> <div class="col-sm-12 p-0"> <div class="col-sm-2 p-0 left"> </div> <div class="col-sm-10 p-0 greycolor right"> <span class="bullet"> Use 8 to 16 character </span><br> <span class="bullet"> Password should contain at least 1 numeric and 1 alphabet </span><br> <span class="bullet"> Special Character </span><br> <span class="bullet"> Password is case sensitives </span><br> <input type="submit" value="Create Password" class="btn btn-primary" ></input> </div> </div> <div class="clearfix"></div> </form> </div> </div> 

You can use the pattern attribute on your input type = "password" to validate the data that is inserted in your form. The pattern accepts regex, which you can test here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM