18 lines
602 B
Python
18 lines
602 B
Python
from django.conf import settings
|
|
|
|
from django_proxmox_mikrotik.settings import ADMIN_BASE_URL
|
|
|
|
|
|
class FrontendSessionMiddleware:
|
|
def __init__(self, get_response):
|
|
self.get_response = get_response
|
|
self.default_session_cookie_name = 'sessionid'
|
|
|
|
def __call__(self, request):
|
|
if not request.path.startswith(ADMIN_BASE_URL):
|
|
settings.SESSION_COOKIE_NAME = settings.SESSION_COOKIE_NAME_FRONTEND
|
|
else:
|
|
settings.SESSION_COOKIE_NAME = self.default_session_cookie_name
|
|
|
|
response = self.get_response(request)
|
|
return response |