mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FEATURE: don't allow username and password to be the same
This commit is contained in:
@ -8,6 +8,8 @@ class PasswordValidator < ActiveModel::EachValidator
|
||||
record.errors.add(attribute, :blank)
|
||||
elsif value.length < SiteSetting.min_password_length
|
||||
record.errors.add(attribute, :too_short, count: SiteSetting.min_password_length)
|
||||
elsif record.username.present? && value == record.username
|
||||
record.errors.add(attribute, :same_as_username)
|
||||
elsif SiteSetting.block_common_passwords && CommonPasswords.common_password?(value)
|
||||
record.errors.add(attribute, :common)
|
||||
end
|
||||
|
Reference in New Issue
Block a user