mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:31:10 +08:00
FEATURE: passwords must have a minimum number of unique characters, configurable with a new setting
This commit is contained in:
@ -18,6 +18,8 @@ class PasswordValidator < ActiveModel::EachValidator
|
||||
record.errors.add(attribute, :same_as_current)
|
||||
elsif SiteSetting.block_common_passwords && CommonPasswords.common_password?(value)
|
||||
record.errors.add(attribute, :common)
|
||||
elsif value.chars.uniq.size < SiteSetting.password_unique_characters
|
||||
record.errors.add(attribute, :unique_characters)
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user