Browse Source

validation.py: check if only ".i2p" supplied as hostname

This is a common error.
pull/1/head
Hidden Z 14 years ago
parent
commit
5da0cc4b59
  1. 3
      web/lib/validation.py

3
web/lib/validation.py

@ -23,6 +23,9 @@ def validate_hostname(data): @@ -23,6 +23,9 @@ def validate_hostname(data):
# Base 32 hostnames (*.b32.i2p) are not allowed
if re.match(r'.*\.b32\.i2p$', data):
raise forms.ValidationError('Base32 hostnames are not allowed')
# prevent common errors
if re.match(r'\.i2p$', data):
raise forms.ValidationError('Incomplete hostname')
# Must not contain '..'
if re.search(r'\.\.', data):
raise forms.ValidationError('".." in hostname')

Loading…
Cancel
Save