diff options
author | José Valim <jose.valim@gmail.com> | 2010-12-19 09:34:31 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-12-19 09:34:31 +0100 |
commit | 432556b9238b182dbd380a8f9936e3ca5dc6fa57 (patch) | |
tree | e6c528fb7bc49c03a605c68b3e1eedbbad10a9ca /activemodel/lib | |
parent | b8f6dd8cbb2de870a4805800fd89148a417bc612 (diff) | |
download | rails-432556b9238b182dbd380a8f9936e3ca5dc6fa57.tar.gz rails-432556b9238b182dbd380a8f9936e3ca5dc6fa57.tar.bz2 rails-432556b9238b182dbd380a8f9936e3ca5dc6fa57.zip |
Make password messages translatable.
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/locale/en.yml | 4 | ||||
-rw-r--r-- | activemodel/lib/active_model/secure_password.rb | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/locale/en.yml b/activemodel/lib/active_model/locale/en.yml index 44425b4a28..c370a1f33e 100644 --- a/activemodel/lib/active_model/locale/en.yml +++ b/activemodel/lib/active_model/locale/en.yml @@ -25,3 +25,7 @@ en: less_than_or_equal_to: "must be less than or equal to %{count}" odd: "must be odd" even: "must be even" + + attributes: + password: + unsecure: "is too weak and common" diff --git a/activemodel/lib/active_model/secure_password.rb b/activemodel/lib/active_model/secure_password.rb index cd6256e3d6..cd997a61db 100644 --- a/activemodel/lib/active_model/secure_password.rb +++ b/activemodel/lib/active_model/secure_password.rb @@ -63,8 +63,8 @@ module ActiveModel def password_must_be_strong if password.present? - errors.add(:password, "must be longer than 6 characters") unless password.size > 6 - errors.add(:password, "is too weak and common") if WEAK_PASSWORDS.include?(password) + errors.add(:password, :too_short, :count => 7) unless password.size > 6 + errors.add(:password, :unsecure) if WEAK_PASSWORDS.include?(password) end end end |