1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-22 20:44:55 +00:00

web/postkey/views.py: add additional validation set for hostnames

Disallow registering set of hostnames intended for i2p project use.
This commit is contained in:
Hidden Z 2010-10-29 17:45:46 +00:00
parent 893d84c08f
commit 390ab411f7

View File

@ -1,3 +1,5 @@
import re
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django import forms
@ -26,6 +28,9 @@ class AddForm(ModelForm):
"""Validate hostname"""
data = self.cleaned_data['name']
data = validate_hostname(data)
# Another set of reserved hostnames (suggested by zzz)
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')
return data
def clean_b64hash(self):
"""Validate base64 hash"""