Hi all,
I have extracted some code from the collection of AR/AM validators few people (incl. me)
have built recently. It brings an optional key “:strength” that could be used to specify what
sort of Regex-based validations the password should pass.
This looks like (default strength is “weak”):
has_secure_password :strength => :strong
You could also use it without ActiveRecord:
class Foo
include ActiveModel::Validations
validates :password_to_validate, :password => { :strength => :medium }
Here is the pull request if you are interested in reviewing it: https://github.com/rails/rails/pull/135
Thanks anyway for that feature,
Franck