Password Strength

Česky: BezpecnostHesla

About

This feature shows, how strong the password is:

  • +1 point for each character over 6 in length
  • +1 point for being mixed case, upper and lower
  • +1 point for including both numbers and letters
  • +1 point for including punctuation
  • less than 3 points → weak password
  • 3 - 5 points → good password
  • 5 and more points → strong password

Example

Type ypur password:
Password strength: not inserted

Example Code

<strong>Type ypur password:</strong>
<input type="password" name="password" id="password" onkeyup="checkPassword(this.value, 'strength', new Array('too short', 'weak', 'good', 'strong'))" />
<br />
<b id="strength">not inserted</b>

Don't forget to include JavaScript library into your page (head section):

<script type="text/javascript" src="password.js"></script>

Description

Integer passwordStrength(String password)

Returns password's strength points

  • password - password to be checked

void checkPassword(String password, String id, Array messages)

Displays message

  • password - password to be checked
  • id - id of element for displaying the message
  • messages - array of messages with 4 elements - for example 'too short', 'weak', 'good', 'strong'

License

© 2008 Adam Heinrich

Licensed under GNU General Public License

Download

Library and example page at http://lib.adamh.cz/password-strength

 
passwordstrength.txt · Poslední úprava: 2017/10/10 00:00 (upraveno mimo DokuWiki)
 
Driven by DokuWiki

© 2008-2012 Adam Heinrich, adamh.cz, adam@adamh.cz