mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-01-10 14:58:05 +00:00
validation.py: hostname must not start with '.' or '-'
I just forgot to add this rule earlier.
This commit is contained in:
parent
76e4ee94ce
commit
ac3df58a3f
@ -32,6 +32,9 @@ def validate_hostname(data):
|
||||
raise forms.ValidationError('Illegal characters in hostname')
|
||||
else:
|
||||
namepart = h.groups()[0]
|
||||
# Must not start with '.' or '-'
|
||||
if re.match(r'^\.|-', namepart):
|
||||
raise forms.ValidationError('Hostname must not starts with "." or "-"')
|
||||
# Must not contain '.-' or '-.' (as of 0.6.1.33)
|
||||
if re.search(r'(\.-)|(-\.)', namepart):
|
||||
raise forms.ValidationError('Hostname contain ".-" or "-."')
|
||||
|
Loading…
Reference in New Issue
Block a user