mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-01-09 14:28:03 +00:00
web/jump/views.py: fix redirects
Accessing invalid or unknown hostnames always caused a redirect loop.
This commit is contained in:
parent
700391d6e8
commit
3230f07160
@ -10,11 +10,11 @@ def jumper(request, data):
|
|||||||
try:
|
try:
|
||||||
hostname = validate_hostname(data)
|
hostname = validate_hostname(data)
|
||||||
except ValidationError, e:
|
except ValidationError, e:
|
||||||
return redirect('error/')
|
return redirect('/jump/error/')
|
||||||
try:
|
try:
|
||||||
key = i2phost.objects.get(name=hostname, activated=True).b64hash
|
key = i2phost.objects.get(name=hostname, activated=True).b64hash
|
||||||
except i2phost.DoesNotExist:
|
except i2phost.DoesNotExist:
|
||||||
return redirect('unknown/')
|
return redirect('/jump/unknown/')
|
||||||
url = 'http://' + hostname + '/?i2paddresshelper=' + key
|
url = 'http://' + hostname + '/?i2paddresshelper=' + key
|
||||||
return redirect(url, permanent=True)
|
return redirect(url, permanent=True)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user