mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Validate domain settings for blocked_onebox_domain only (#15754)
We want to prevent the user from adding ? or * minimally when setting domains in sitesettings
This commit is contained in:
15
lib/validators/host_list_setting_validator.rb
Normal file
15
lib/validators/host_list_setting_validator.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class HostListSettingValidator
|
||||
def initialize(opts = {})
|
||||
@opts = opts
|
||||
end
|
||||
|
||||
def valid_value?(val)
|
||||
val.exclude?("*") && val.exclude?("?")
|
||||
end
|
||||
|
||||
def error_message
|
||||
I18n.t('site_settings.errors.invalid_domain_hostname')
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user