Browse Source

web/jump/views.py: fix redirects

Accessing invalid or unknown hostnames always caused a redirect loop.
pull/1/head
Hidden Z 14 years ago
parent
commit
3230f07160
  1. 4
      web/jump/views.py

4
web/jump/views.py

@ -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…
Cancel
Save