mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: new setting min_admin_password_length and better default
This commit is contained in:
parent
c15c483931
commit
50e65634d7
6 changed files with 23 additions and 6 deletions
|
@ -6,6 +6,8 @@ class PasswordValidator < ActiveModel::EachValidator
|
|||
return unless record.password_required?
|
||||
if value.nil?
|
||||
record.errors.add(attribute, :blank)
|
||||
elsif value.length < SiteSetting.min_admin_password_length && record.admin?
|
||||
record.errors.add(attribute, :too_short, count: SiteSetting.min_admin_password_length)
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue