server/src/metaeducation/middleware.py
changeset 15 8004d8fc9b38
parent 4 8bc8b208441d
child 27 c3c6f2f85680
--- a/server/src/metaeducation/middleware.py	Wed Mar 09 16:38:39 2016 +0100
+++ b/server/src/metaeducation/middleware.py	Thu Mar 10 13:32:18 2016 +0100
@@ -4,8 +4,8 @@
 from re import compile
 
 EXEMPT_URLS = [compile(settings.LOGIN_URL.lstrip('/'))]
-if hasattr(settings, 'LOGIN_EXEMPT_URLS'):
-    EXEMPT_URLS += [compile(expr) for expr in settings.LOGIN_EXEMPT_URLS]
+if hasattr(settings, 'OAUTH_EXEMPT_URLS'):
+    EXEMPT_URLS += [compile(expr) for expr in settings.OAUTH_EXEMPT_URLS]
 
 class MtdcLoginRequiredWithContextMiddleware:
     """
@@ -18,5 +18,6 @@
                 if request.GET.get("context", ""):
                     context = request.GET["context"]
                     response = redirect(settings.LOGIN_URL)
-                    response["LOCATION"] += "?"+urlencode({"context": context, "next": "/"+path})
+                    print(path)
+                    response["LOCATION"] += "?"+urlencode({"context": context, "next": settings.URL_SUBDIRECTORY+"/"+path})
                     return response