mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-01-22 20:44:55 +00:00
validation.py: check for pasting i2p router hash
This commit is contained in:
parent
a287860619
commit
700391d6e8
@ -69,6 +69,10 @@ def validate_b64hash(data, check_uniq=True):
|
|||||||
# fail if contains .i2p= (full foo.i2p=key)
|
# fail if contains .i2p= (full foo.i2p=key)
|
||||||
if re.search(r'\.i2p=', data):
|
if re.search(r'\.i2p=', data):
|
||||||
raise forms.ValidationError('Do not paste full hosts.txt entry! Only base64 hash are needed')
|
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
|
# Minimum key length 516 bytes
|
||||||
if length < 516:
|
if length < 516:
|
||||||
raise forms.ValidationError('Specified base64 hash are less than 516 bytes')
|
raise forms.ValidationError('Specified base64 hash are less than 516 bytes')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user