Fix domain list bug (#12268)
This commit is contained in:
parent
31689fd76a
commit
444841bb90
2 changed files with 8 additions and 1 deletions
|
|
@ -16,7 +16,7 @@ module SiteConfigs
|
|||
|
||||
VALID_URL = %r{\A(http|https)://([/|.\w\s-])*.[a-z]{2,5}(:[0-9]{1,5})?(/.*)?\z}.freeze
|
||||
|
||||
VALID_DOMAIN = /^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+$/.freeze
|
||||
VALID_DOMAIN = /^[a-zA-Z0-9]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+$/.freeze
|
||||
|
||||
PARAMS_TO_BE_CLEANED = %i[sidebar_tags suggested_tags suggested_users].freeze
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,13 @@ RSpec.describe "/admin/config", type: :request do
|
|||
expect(SiteConfig.allowed_registration_email_domains).to eq(%w[dev.to forem.com forem.dev])
|
||||
end
|
||||
|
||||
it "allows 2-character domains" do
|
||||
proper_list = "dev.to, forem.com, 2u.com"
|
||||
post "/admin/config", params: { site_config: { allowed_registration_email_domains: proper_list },
|
||||
confirmation: confirmation_message }
|
||||
expect(SiteConfig.allowed_registration_email_domains).to eq(%w[dev.to forem.com 2u.com])
|
||||
end
|
||||
|
||||
it "does not allow improper domain list" do
|
||||
impproper_list = "dev.to, foremcom, forem.dev"
|
||||
post "/admin/config", params: { site_config: { allowed_registration_email_domains: impproper_list },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue