mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-01-22 20:44:55 +00:00
web/postkey/views.py: avoid adding non-unique hashes
This commit is contained in:
parent
def26f43ef
commit
5cb9d1943a
@ -64,6 +64,10 @@ class AddForm(ModelForm):
|
||||
# base64-i2p
|
||||
if re.match(r'[a-zA-Z0-9\-~]+AAAA$', data) == None:
|
||||
raise forms.ValidationError('Invalid base64 hash')
|
||||
# Avoid adding non-unique hashes
|
||||
qs = i2phost.objects.filter(b64hash=data)
|
||||
if qs.exists():
|
||||
raise forms.ValidationError('Base64 hash must be unique')
|
||||
return data
|
||||
|
||||
def addkey(request):
|
||||
|
Loading…
x
Reference in New Issue
Block a user