Bug Software

... jQuery plugins ... password strengthener ...

Password Strengthener

I was building a secure web application recently and was trying to find a plugin that would stop users entering stupid rubbish passwords. I could not find one which did exactly what I wanted. So I built on myself. Here is what I came up with.

Simple clean code

No need to include any messy inline JavaScript.

              <html>
<head>
<script src="/js/jquery-1.4.1-min.js" type="text/javascript"></script>
<script src="/js/js/jquery.passStrengthener.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
    var jSubmit = jQuery('form input[type=submit]');
    jQuery("#new_pass").passStrengthener({userid: "#user_id"});
  });
</script> 
</head>

<body>
<form action="" method="POST">
  <p>
    <label>username</label>
    <input type="text" name="user_id" value="joeblogs" id="user_id" />
  </p>
  <p>
    <label>new password</label>
    <input type="password" name="new_pass" id="new_pass" value="" />
  </p>
  <p>
    <input type="submit" value="change password" disabled="disabled" />
  </p>
</form>
</body>
</html>
	
            

jQuery plugin page

Download

jquery.passStrengthener.js V0.9.1

Example of 'Password Strengthener'

Here is a very simple demonstration of 'Password Strengthener'.




Feedback (2 comments)

Please post any feedback, live examples, bugs, features and change requests here.

  1. . - OuT

    2010-05-11 22:40:11

    this is even better :

    case-sensitive version :
    if (password.match(/^[a-zA-Z]+$|^[0-9]+$/) )

    case-insensitive version :
    if (password.match(/^[a-z]+$|^[A-Z]+$|^[0-9]+$/) )

    I let you choose which one to use
    cheers

  2. regex - OuT

    2010-05-10 08:28:43

    Hi, found a little bug

    lines 202, 203 :
    //password is just a numbers or chars
    if (password.match(/^\w+$/) || password.match(/^\d+$/) )

    since \w means [a-zA-Z0-9_], I think the correct test would instead be :

    if (password.match(/^[a-zA-Z]+$/) || password.match(/^\d+$/) )

    or, because I personally think it is less confusing (as you demonstrated ;) :

    if (password.match(/^[a-zA-Z]+$/) || password.match(/^[0-9]+$/) )

    regards

Top Trackbacks

  1. http://plugins.jquery.com/project/PassStrengthener1207 referals (first recorded: 2010-02-09 12:01:41)
  2. http://coliss.com/articles/build-websites/operation/javascript/jquery-plug...39 referals (first recorded: 2010-02-09 12:00:50)
  3. http://www.google.it/url?sa=t&source=web&ct=res&cd=3&ved=0CBAQFjAC&url=htt...6 referals (first recorded: 2010-02-09 22:43:21)
  4. http://www.google.co.uk/search?hl=en-GB&q=passStrengthener&sourceid=navcli...3 referals (first recorded: 2010-02-10 11:16:27)
  5. http://www.google.fr/search?hl=fr&ei=mHHMS5SJOJSGsAaWx-CTAw&sa=X&oi=spell&...3 referals (first recorded: 2010-04-19 16:07:09)
  6. http://delicious.com/save?url=http%3A%2F%2Fbugsoftware.co.uk%2FjQuery%2FPa...2 referals (first recorded: 2010-03-31 20:20:01)
  7. http://neorent.pl/mantis/view.php?id=32 referals (first recorded: 2010-04-09 00:16:34)
  8. http://www.google.sk/search?hl=sk&client=opera&hs=LV5&rls=sk&q=pass+Streng...1 referals (first recorded: 2010-02-19 10:09:29)
  9. http://www.google.com/search?num=100&hl=ja&ie=sjis&oe=sjis&q=JS&filter=01 referals (first recorded: 2010-02-23 07:23:37)
  10. http://www.google.de/search?hl=de&rlz=1B3GGGL_deDE223DE228&q=jquery+passwo...1 referals (first recorded: 2010-03-08 07:27:05)

© Bug Software Limited 2009 - 2010

...this site is based on Bug Software's PHP / XML / XSLT framework