Minimum password length is configurable with the min_password_length site setting. FIX: reset password needs to validate password length.

This commit is contained in:
Neil Lalonde
2013-12-19 16:15:36 -05:00
parent 33c6997ded
commit 854d9c8fc6
7 changed files with 43 additions and 24 deletions

View File

@ -4,8 +4,8 @@ class PasswordValidator < ActiveModel::EachValidator
return unless record.password_required?
if value.nil?
record.errors.add(attribute, :blank)
elsif value.length < 6
record.errors.add(attribute, :too_short, count: 6)
elsif value.length < SiteSetting.min_password_length
record.errors.add(attribute, :too_short, count: SiteSetting.min_password_length)
end
end