check length of domain, and check for domains with more than one period

This commit is contained in:
Kyle Drake 2013-07-28 18:37:12 -04:00
parent b8c4e4ec17
commit e4fae57104

View file

@ -97,7 +97,7 @@ class Site < Sequel::Model
end
if !values[:domain].nil? && !values[:domain].empty?
if !(values[:domain] =~ /^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$/i)
if !(values[:domain] =~ /^[a-zA-Z0-9.]+\.[a-zA-Z0-9]+$/i) || values[:domain].length > 90
errors.add :domain, "Domain provided is not valid. Must take the form of domain.com"
end