mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 06:41:25 +08:00
FIX: don't allow username to be changed to same as password
We were blocking user registrations with same username and password, but allowing usernames to be changed to be same as password later. Also disallow names to be the same as password.
This commit is contained in:
@ -15,6 +15,8 @@ class PasswordValidator < ActiveModel::EachValidator
|
||||
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 record.name.present? && value == record.name
|
||||
record.errors.add(attribute, :same_as_name)
|
||||
elsif record.email.present? && value == record.email
|
||||
record.errors.add(attribute, :same_as_email)
|
||||
elsif record.confirm_password?(value)
|
||||
|
Reference in New Issue
Block a user