FIX: Password required flag should be cleared whenever clearing the raw password (#5384)

This commit is contained in:
Vinoth Kannan
2017-12-01 09:49:24 +05:30
committed by Sam
parent 9876f3d0ee
commit 7f2eeaf767
7 changed files with 38 additions and 12 deletions

View File

@@ -3,7 +3,8 @@ require_dependency "common_passwords/common_passwords"
class PasswordValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return unless record.password_required?
return unless record.password_validation_required?
if value.nil?
record.errors.add(attribute, :blank)
elsif value.length < SiteSetting.min_admin_password_length && (record.admin? || is_developer?(record.email))