Sfoglia il codice sorgente

Redirect user to previous page after logging in

Jeremy Stretch 9 anni fa
parent
commit
579ed0a985
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      netbox/utilities/middleware.py

+ 1 - 1
netbox/utilities/middleware.py

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