mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: make full names a required field of user profiles with the full_name_required setting
This commit is contained in:
8
lib/validators/user_full_name_validator.rb
Normal file
8
lib/validators/user_full_name_validator.rb
Normal file
@ -0,0 +1,8 @@
|
||||
class UserFullNameValidator < ActiveModel::EachValidator
|
||||
|
||||
def validate_each(record, attribute, value)
|
||||
if SiteSetting.full_name_required && !record.name.present?
|
||||
record.errors.add(attribute, :blank)
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user