1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Merged v2.5.13

This commit is contained in:
Jeremy Stretch
2019-05-31 21:37:41 -04:00
40 changed files with 801 additions and 769 deletions

View File

@ -2,6 +2,7 @@ from django.conf import settings
from django.db import ProgrammingError
from django.http import Http404, HttpResponseRedirect
from django.urls import reverse
import urllib
from .views import server_error
@ -22,7 +23,12 @@ class LoginRequiredMiddleware(object):
# performs its own authentication. Also metrics can be read without login.
api_path = reverse('api-root')
if not request.path_info.startswith((api_path, '/metrics')) and request.path_info != settings.LOGIN_URL:
return HttpResponseRedirect('{}?next={}'.format(settings.LOGIN_URL, request.path_info))
return HttpResponseRedirect(
'{}?next={}'.format(
settings.LOGIN_URL,
urllib.parse.quote(request.get_full_path_info())
)
)
return self.get_response(request)