Skip to content

Commit

Permalink
New password default minimum length is now 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigo Flores committed Jul 6, 2012
1 parent 1aca139 commit 2950434
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/devise.rb
Expand Up @@ -90,7 +90,7 @@ module Strategies

# Range validation for password length
mattr_accessor :password_length
@@password_length = 8..128
@@password_length = 6..128

# The time the user will be remembered without asking for credentials again.
mattr_accessor :remember_for
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/templates/devise.rb
Expand Up @@ -114,7 +114,7 @@

# ==> Configuration for :validatable
# Range for password length. Default is 8..128.
# config.password_length = 8..128
config.password_length = 8..128

# Email regex used to validate email formats. It simply asserts that
# an one (and only one) @ exists in the given string. This is mainly
Expand Down
6 changes: 3 additions & 3 deletions test/models/validatable_test.rb
Expand Up @@ -76,10 +76,10 @@ class ValidatableTest < ActiveSupport::TestCase
assert_equal 'doesn\'t match confirmation', user.errors[:password].join
end

test 'should require a password with minimum of 8 characters' do
user = new_user(:password => '1234567', :password_confirmation => '1234567')
test 'should require a password with minimum of 6 characters' do
user = new_user(:password => '12345', :password_confirmation => '12345')
assert user.invalid?
assert_equal 'is too short (minimum is 8 characters)', user.errors[:password].join
assert_equal 'is too short (minimum is 6 characters)', user.errors[:password].join
end

test 'should require a password with maximum of 128 characters long' do
Expand Down

0 comments on commit 2950434

Please sign in to comment.