mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 14:55:48 +08:00
use chars as opposed to split
This commit is contained in:
parent
5346cd3514
commit
dacfdd4dc8
|
@ -18,7 +18,7 @@ class PasswordValidator < ActiveModel::EachValidator
|
||||||
record.errors.add(attribute, :same_as_current)
|
record.errors.add(attribute, :same_as_current)
|
||||||
elsif SiteSetting.block_common_passwords && CommonPasswords.common_password?(value)
|
elsif SiteSetting.block_common_passwords && CommonPasswords.common_password?(value)
|
||||||
record.errors.add(attribute, :common)
|
record.errors.add(attribute, :common)
|
||||||
elsif value.split("").uniq.length < SiteSetting.password_unique_characters
|
elsif value.chars.uniq.length < SiteSetting.password_unique_characters
|
||||||
record.errors.add(attribute, :unique_characters)
|
record.errors.add(attribute, :unique_characters)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user