mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 07:06:47 +08:00
SECURITY: don't allow re-using the current password during password reset
This commit is contained in:
@ -14,6 +14,8 @@ class PasswordValidator < ActiveModel::EachValidator
|
||||
record.errors.add(attribute, :same_as_username)
|
||||
elsif record.email.present? && value == record.email
|
||||
record.errors.add(attribute, :same_as_email)
|
||||
elsif record.confirm_password?(value)
|
||||
record.errors.add(attribute, :same_as_current)
|
||||
elsif SiteSetting.block_common_passwords && CommonPasswords.common_password?(value)
|
||||
record.errors.add(attribute, :common)
|
||||
end
|
||||
|
Reference in New Issue
Block a user