From 432556b9238b182dbd380a8f9936e3ca5dc6fa57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 19 Dec 2010 09:34:31 +0100 Subject: Make password messages translatable. --- activemodel/lib/active_model/locale/en.yml | 4 ++++ activemodel/lib/active_model/secure_password.rb | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'activemodel/lib/active_model') 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 -- cgit v1.2.3