Weakling is a simple prototype-based javascript plugin to measure the strength of a password.
I significantly modified Frane’s plugin called password_strength_meter
I didn’t want a percentage bar so I stripped that out, I refactored the helper to be more readable. It passes a hash instead of array for strength text Its supports locales.
./script/plugin install git://github.com/omenking/weakling.git
Then add this to your config/locales/en.yml
weakling:
default: Must be at least 5 characters
error: too short
weak: weak
average: average
strong: strong
Go get em and place them in your public/javascripts
The add into your layout head
<%= javascript_include_tag ‘prototype’, ‘weakling’ >
<= stylesheet_link_tag ‘weakling.css’ %>
<%= f.password_field :password >
<= password_strength :password_strength, ‘user_password’ %>
password_strength(name,target,options={})
- name – id of the password_strength
- target – id of the password_field
If you have Sass or Sprockets installed it’ll copy them to their respected default directories.
Sass and Sprockets rule!
Remember to add to your app/javascripts/application.js
//= require
Remember to add to your application.sass
@import weakling.sass
Copyright © 2009 Andrew Brown, released under the MIT license