Explorar o código

Redirect user to previous page after logging in

Jeremy Stretch %!s(int64=9) %!d(string=hai) anos
pai
achega
579ed0a985
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      netbox/utilities/middleware.py

+ 1 - 1
netbox/utilities/middleware.py

@@ -12,4 +12,4 @@ class LoginRequiredMiddleware:
     def process_request(self, request):
         if LOGIN_REQUIRED and not request.user.is_authenticated():
             if request.path_info != settings.LOGIN_URL:
-                return HttpResponseRedirect(settings.LOGIN_URL)
+                return HttpResponseRedirect('{}?next={}'.format(settings.LOGIN_URL, request.path_info))