Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 19th, 2012  |  syntax: JavaScript  |  size: 1.06 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //password has 3 numbers
  2.     if (password.match(/(.*[0-9].*[0-9].*[0-9])/))  score += 5
  3.    
  4.     //password has 2 sybols
  5.     if (password.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)) score += 5
  6.    
  7.     //password has Upper and Lower chars
  8.     if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))  score += 10
  9.    
  10.     //password has number and chars
  11.     if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/))  score += 15
  12.     //
  13.     //password has number and symbol
  14.     if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([0-9])/))  score += 15
  15.    
  16.     //password has char and symbol
  17.     if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([a-zA-Z])/))  score += 15
  18.    
  19.     //password is just a nubers or chars
  20.     if (password.match(/^\w+$/) || password.match(/^\d+$/) )  score -= 10
  21.    
  22.     //verifing 0 < score < 100
  23.     if ( score < 0 )  score = 0
  24.     if ( score > 100 )  score = 100
  25.    
  26.     if (score < 34 )  return badPass
  27.     if (score < 68 )  return goodPass
  28.     return strongPass