From 45fff7057b9812427c6ca17dd28edda6af2c6ff6 Mon Sep 17 00:00:00 2001 From: Joel Valleroy Date: Sat, 14 Nov 2015 17:23:06 -0500 Subject: [PATCH] Allow hyphens in hostname and domainname. Fixes #275. --- plinth/modules/config/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plinth/modules/config/config.py b/plinth/modules/config/config.py index 519a1d7ec..9944b896a 100644 --- a/plinth/modules/config/config.py +++ b/plinth/modules/config/config.py @@ -68,7 +68,7 @@ class ConfigurationForm(forms.Form): 'start with an alphabet and must not be greater than 63 ' 'characters in length.'), validators=[ - validators.RegexValidator(r'^[a-zA-Z][a-zA-Z0-9]{,62}$', + validators.RegexValidator(r'^[a-zA-Z][-a-zA-Z0-9]{,61}[a-zA-Z0-9]$', ugettext_lazy('Invalid hostname'))]) domainname = TrimmedCharField( @@ -79,7 +79,7 @@ class ConfigurationForm(forms.Form): 'of alphanumeric words separated by dots.'), required=False, validators=[ - validators.RegexValidator(r'^[a-zA-Z][a-zA-Z0-9.]*$', + validators.RegexValidator(r'^[a-zA-Z][-a-zA-Z0-9.]*[a-zA-Z0-9]$', ugettext_lazy('Invalid domain name'))])