]> sipb.mit.edu Git - snippets/.git/commitdiff
Scripts auth: don't activate on 127.0.0.1 either
authorAlex Dehnert <adehnert@mit.edu>
Sun, 7 Jul 2013 04:27:57 +0000 (00:27 -0400)
committerAlex Dehnert <adehnert@mit.edu>
Sun, 7 Jul 2013 04:27:57 +0000 (00:27 -0400)
The scripts auth module has long delegated to the standard Django auth when the
hostname was localhost, in order to ignore local dev server instances. This
makes it also delegate to standard Django for 127.0.0.1 as well.  I'm not sure
why this hadn't come up before now... A quick look at the Django codebase
suggests this isn't a recent change.

__init__.py

index 73e7e88d4978a4933a071432dcb0c55b73d939cc..4d093137dce4e5c278ff26d71b381159ffbc894c 100644 (file)
@@ -129,7 +129,7 @@ def get_or_create_mit_user(username, ):
 
 def scripts_login(request, **kwargs):
     host = request.META['HTTP_HOST'].split(':')[0]
 
 def scripts_login(request, **kwargs):
     host = request.META['HTTP_HOST'].split(':')[0]
-    if host == 'localhost':
+    if host in ('localhost', '127.0.0.1'):
         return login(request, **kwargs)
     elif request.META['SERVER_PORT'] == '444':
         if request.user.is_authenticated():
         return login(request, **kwargs)
     elif request.META['SERVER_PORT'] == '444':
         if request.user.is_authenticated():