From 4632208699e9282a5eac6cd475f67f0b90b1d144 Mon Sep 17 00:00:00 2001 From: Nascher Date: Sat, 29 Aug 2015 15:31:54 +0000 Subject: [PATCH 1/2] Increase the maximum password length --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index e51f7eb6..8912960d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -100,7 +100,7 @@ class User < ActiveRecord::Base validates_presence_of :login validates_presence_of :password, if: :password_required? - validates_length_of :password, within: 5..40, if: :password_required? + validates_length_of :password, within: 5..128, if: :password_required? validates_presence_of :password_confirmation, if: :password_required? validates_confirmation_of :password validates_length_of :login, within: 3..80 From dd6698b8a19853962c690b7924c617d07714912a Mon Sep 17 00:00:00 2001 From: Nascher Date: Sat, 29 Aug 2015 23:58:02 +0000 Subject: [PATCH 2/2] Update the maximum password length --- app/models/user.rb | 2 +- test/models/user_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 8912960d..686a045e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -100,7 +100,7 @@ class User < ActiveRecord::Base validates_presence_of :login validates_presence_of :password, if: :password_required? - validates_length_of :password, within: 5..128, if: :password_required? + validates_length_of :password, within: 5..72, if: :password_required? validates_presence_of :password_confirmation, if: :password_required? validates_confirmation_of :password validates_length_of :login, within: 3..80 diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 6812dc87..20188647 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -44,8 +44,8 @@ class UserTest < ActiveSupport::TestCase def test_validate_long_password assert_no_difference 'User.count' do - u = create_user :password => generate_random_string(41) - assert_equal "is too long (maximum is 40 characters)", u.errors[:password][0] + u = create_user :password => generate_random_string(73) + assert_equal "is too long (maximum is 72 characters)", u.errors[:password][0] end end