1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-02-09 05:14:22 +00:00

web/postkey/views.py: allow only 2-level domains

Until we haven't implemented subdomain auth, reject subdomains
registration via webinterface et all.
This commit is contained in:
Hidden Z 2010-10-29 17:50:21 +00:00
parent 390ab411f7
commit d6dfee3f78

View File

@ -31,6 +31,8 @@ class AddForm(ModelForm):
# Another set of reserved hostnames (suggested by zzz) # Another set of reserved hostnames (suggested by zzz)
if re.search(r'(^|\.)(i2p|i2p2|geti2p|mail|project|i2project|i2pproject|i2p-project).i2p$', data): if re.search(r'(^|\.)(i2p|i2p2|geti2p|mail|project|i2project|i2pproject|i2p-project).i2p$', data):
raise forms.ValidationError('Trying to use hostname from additional reserved set') raise forms.ValidationError('Trying to use hostname from additional reserved set')
if data.count('.') > 1:
raise forms.ValidationError('Currently only 2-level domains are allowed')
return data return data
def clean_b64hash(self): def clean_b64hash(self):
"""Validate base64 hash""" """Validate base64 hash"""