From 715ad1320c33f516e8e077c9c6759b9dea438f22 Mon Sep 17 00:00:00 2001 From: pablohashescobar Date: Thu, 16 May 2024 11:58:15 +0530 Subject: [PATCH] dev: fix session token save on admin and remove session save every request --- apiserver/plane/authentication/utils/login.py | 6 ++++++ apiserver/plane/settings/common.py | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apiserver/plane/authentication/utils/login.py b/apiserver/plane/authentication/utils/login.py index 45dbdc249..f5d453d02 100644 --- a/apiserver/plane/authentication/utils/login.py +++ b/apiserver/plane/authentication/utils/login.py @@ -1,5 +1,6 @@ # Django imports from django.contrib.auth import login +from django.conf import settings # Module imports from plane.authentication.utils.host import base_host @@ -7,6 +8,11 @@ from plane.authentication.utils.host import base_host def user_login(request, user, is_app=False, is_admin=False, is_space=False): login(request=request, user=user) + + # If is admin cookie set the custom age + if is_admin: + request.session.set_expiry(settings.ADMIN_SESSION_COOKIE_AGE) + device_info = { "user_agent": request.META.get("HTTP_USER_AGENT", ""), "ip_address": request.META.get("REMOTE_ADDR", ""), diff --git a/apiserver/plane/settings/common.py b/apiserver/plane/settings/common.py index f043340a2..642ece237 100644 --- a/apiserver/plane/settings/common.py +++ b/apiserver/plane/settings/common.py @@ -331,7 +331,6 @@ SESSION_ENGINE = "plane.db.models.session" SESSION_COOKIE_AGE = 604800 SESSION_COOKIE_NAME = "plane-session-id" SESSION_COOKIE_DOMAIN = os.environ.get("COOKIE_DOMAIN", None) -SESSION_SAVE_EVERY_REQUEST = True # Admin Cookie ADMIN_SESSION_COOKIE_NAME = "plane-admin-session-id"