From 12b2f2f499dee1e1d30fee1dce368aeed298d085 Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 17 Jul 2019 12:54:00 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E5=88=B7=E6=96=B0session=E6=9C=89?= =?UTF-8?q?=E6=95=88=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jumpserver/middleware.py | 2 ++ apps/orgs/middleware.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/jumpserver/middleware.py b/apps/jumpserver/middleware.py index a99c2e6e5..f2ea1f077 100644 --- a/apps/jumpserver/middleware.py +++ b/apps/jumpserver/middleware.py @@ -56,4 +56,6 @@ class RequestMiddleware: def __call__(self, request): set_current_request(request) response = self.get_response(request) + age = request.session.get_expiry_age() + request.session.set_expiry(age) return response diff --git a/apps/orgs/middleware.py b/apps/orgs/middleware.py index cda25bedc..24a2b99fe 100644 --- a/apps/orgs/middleware.py +++ b/apps/orgs/middleware.py @@ -25,7 +25,8 @@ class OrgMiddleware: def __call__(self, request): self.set_permed_org_if_need(request) org = get_org_from_request(request) - request.current_org = org - set_current_org(org) + if org is not None: + request.current_org = org + set_current_org(org) response = self.get_response(request) return response