From 4ba29fc3ffacf197908126b2877901c6f7d98997 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 4 Nov 2013 23:09:24 +0100 Subject: [PATCH] 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. --- nsupdate/api/views.py | 8 ++++---- nsupdate/main/urls.py | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/nsupdate/api/views.py b/nsupdate/api/views.py index dd8a555..360b553 100644 --- a/nsupdate/api/views.py +++ b/nsupdate/api/views.py @@ -36,19 +36,19 @@ def MyIpView(request): 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 into the client's session. :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 """ # 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 - # the secret: - s = SessionStore(session_key=secret) + # the sessionid: + s = SessionStore(session_key=sessionid) ipaddr = request.META['REMOTE_ADDR'] key = check_ip(ipaddr) s[key] = ipaddr diff --git a/nsupdate/main/urls.py b/nsupdate/main/urls.py index c28807b..6edf77d 100644 --- a/nsupdate/main/urls.py +++ b/nsupdate/main/urls.py @@ -25,8 +25,7 @@ urlpatterns = patterns( url(r'^domain_overview/$', DomainOverwievView.as_view(), name='domain_overview'), url(r'^domain/(?P\d+)/delete/$', DeleteDomainView.as_view(), name='delete_domain'), # internal use by the web ui - url(r'^detectip/$', DetectIpView), # XXX for what is this used WITHOUT a secret? - url(r'^detectip/(?P\w+)/$', DetectIpView), + url(r'^detectip/(?P\w+)/$', DetectIpView), url(r'^ajax_get_ips/$', AjaxGetIps, name="ajax_get_ips"), url(r'^nic/update_authorized$', AuthorizedNicUpdateView, name='nic_update_authorized'), # api (for update clients)