Browse Source

validation.py: check for pasting i2p router hash

pull/1/head
Hidden Z 14 years ago
parent
commit
700391d6e8
  1. 4
      web/lib/validation.py

4
web/lib/validation.py

@ -69,6 +69,10 @@ def validate_b64hash(data, check_uniq=True): @@ -69,6 +69,10 @@ def validate_b64hash(data, check_uniq=True):
# fail if contains .i2p= (full foo.i2p=key)
if re.search(r'\.i2p=', data):
raise forms.ValidationError('Do not paste full hosts.txt entry! Only base64 hash are needed')
# check for pasting router hash
if length == 44:
raise forms.ValidationError('Do not paste router hash! Go to i2ptunnel page and \
find a destination hash')
# Minimum key length 516 bytes
if length < 516:
raise forms.ValidationError('Specified base64 hash are less than 516 bytes')

Loading…
Cancel
Save