javascript - Password validation script. Add symbols -


i trying simple password strength checker. im new , couldnt find how include symbols in code.whats command add symbols?

    $(document).ready(function() {  $('input[type=password]').keyup(function() {   var pswd = $(this).val();   if ( pswd.length < 8 ) {     $('#length').removeclass('valid').addclass('invalid'); } else {     $('#length').removeclass('invalid').addclass('valid'); } //validate letter if ( pswd.match(/[a-z]/) ) {     $('#letter').removeclass('invalid').addclass('valid'); } else {     $('#letter').removeclass('valid').addclass('invalid'); }  //validate capital letter if ( pswd.match(/[a-z]/) ) {     $('#capital').removeclass('invalid').addclass('valid'); } else {     $('#capital').removeclass('valid').addclass('invalid'); }  //validate number if ( pswd.match(/\d/) ) {     $('#number').removeclass('invalid').addclass('valid'); } else {     $('#number').removeclass('valid').addclass('invalid'); } }).focus(function() {     $('#pswd_info').show(); }).blur(function() {     $('#pswd_info').hide(); });  }); 

you can use following regex validate password:

if( pswd.match(/[$-/:-?{-~!"^_`\[\]]/) ) {     $('#symbol').removeclass('invalid').addclass('valid'); } else {     $('#symbol').removeclass('valid').addclass('invalid'); } 

it checks follwoing symbols in password:

!$%^&*()_+|~-=`{}[]:";'<>?,./ 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -