From 4df1aef48e58c3386a17591eac1fced9c55a4a8e Mon Sep 17 00:00:00 2001 From: Alex Dehnert Date: Sat, 29 May 2010 22:34:45 -0400 Subject: [PATCH] localhost check needs to use portless-HTTP_HOST As a bonus, this gets around the problem that the Django dev server doesn't set REQUEST_URI. --- __init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__init__.py b/__init__.py index 8858248..8f785ae 100644 --- a/__init__.py +++ b/__init__.py @@ -46,7 +46,8 @@ class ScriptsRemoteUserBackend(RemoteUserBackend): return user def scripts_login(request, **kwargs): - if request.META['HTTP_HOST'] == 'localhost': + host = request.META['HTTP_HOST'].split(':')[0] + if host == 'localhost': return login(request, **kwargs) elif request.META['SERVER_PORT'] == '444': if request.user.is_authenticated(): @@ -64,6 +65,5 @@ def scripts_login(request, **kwargs): return login(request, **kwargs) else: # Move to port 444 - host = request.META['HTTP_HOST'].split(':')[0] redirect_to = "https://%s:444%s" % (host, request.META['REQUEST_URI'], ) return HttpResponseRedirect(redirect_to) -- 2.45.0