mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
allow localhost as an embeddedable host
This commit is contained in:
@@ -25,7 +25,8 @@ class EmbeddableHost < ActiveRecord::Base
|
|||||||
|
|
||||||
def host_must_be_valid
|
def host_must_be_valid
|
||||||
if host !~ /\A[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,7}(:[0-9]{1,5})?(\/.*)?\Z/i &&
|
if host !~ /\A[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,7}(:[0-9]{1,5})?(\/.*)?\Z/i &&
|
||||||
host !~ /\A(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\Z/
|
host !~ /\A(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\Z/ &&
|
||||||
|
host !~ /\A([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.)?localhost(\:[0-9]{1,5})?(\/.*)?\Z/i
|
||||||
errors.add(:host, I18n.t('errors.messages.invalid'))
|
errors.add(:host, I18n.t('errors.messages.invalid'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user