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))