From 579ed0a98571ff6027b3506f140ba01b54d680a3 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 13 Oct 2016 16:12:27 -0400 Subject: [PATCH] Redirect user to previous page after logging in --- netbox/utilities/middleware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/utilities/middleware.py b/netbox/utilities/middleware.py index 563e4a0fe..e37c1fcca 100644 --- a/netbox/utilities/middleware.py +++ b/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))