detectip: it is not valid without a sessionid, remove the view

and as we currently use the sessionid, we should also name it like that.
This commit is contained in:
Thomas Waldmann 2013-11-04 23:09:24 +01:00
parent 0ce04a64cb
commit 4ba29fc3ff
2 changed files with 5 additions and 6 deletions

View File

@ -36,19 +36,19 @@ def MyIpView(request):
return Response(request.META['REMOTE_ADDR']) return Response(request.META['REMOTE_ADDR'])
def DetectIpView(request, secret=None): def DetectIpView(request, sessionid):
""" """
Put the IP address (can be v4 or v6) of the client requesting this view Put the IP address (can be v4 or v6) of the client requesting this view
into the client's session. into the client's session.
:param request: django request object :param request: django request object
:param secret: session key used to find the correct session w/o session cookie :param sessionid: sessionid from url used to find the correct session w/o session cookie
:return: HttpResponse object :return: HttpResponse object
""" """
# we do not have the session as usual, as this is a different host, # we do not have the session as usual, as this is a different host,
# so the session cookie is not received here - thus we access it via # so the session cookie is not received here - thus we access it via
# the secret: # the sessionid:
s = SessionStore(session_key=secret) s = SessionStore(session_key=sessionid)
ipaddr = request.META['REMOTE_ADDR'] ipaddr = request.META['REMOTE_ADDR']
key = check_ip(ipaddr) key = check_ip(ipaddr)
s[key] = ipaddr s[key] = ipaddr

View File

@ -25,8 +25,7 @@ urlpatterns = patterns(
url(r'^domain_overview/$', DomainOverwievView.as_view(), name='domain_overview'), url(r'^domain_overview/$', DomainOverwievView.as_view(), name='domain_overview'),
url(r'^domain/(?P<pk>\d+)/delete/$', DeleteDomainView.as_view(), name='delete_domain'), url(r'^domain/(?P<pk>\d+)/delete/$', DeleteDomainView.as_view(), name='delete_domain'),
# internal use by the web ui # internal use by the web ui
url(r'^detectip/$', DetectIpView), # XXX for what is this used WITHOUT a secret? url(r'^detectip/(?P<sessionid>\w+)/$', DetectIpView),
url(r'^detectip/(?P<secret>\w+)/$', DetectIpView),
url(r'^ajax_get_ips/$', AjaxGetIps, name="ajax_get_ips"), url(r'^ajax_get_ips/$', AjaxGetIps, name="ajax_get_ips"),
url(r'^nic/update_authorized$', AuthorizedNicUpdateView, name='nic_update_authorized'), url(r'^nic/update_authorized$', AuthorizedNicUpdateView, name='nic_update_authorized'),
# api (for update clients) # api (for update clients)