mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
dev: fix session token save on admin and remove session save every request
This commit is contained in:
parent
92c5ccef3d
commit
715ad1320c
@ -1,5 +1,6 @@
|
|||||||
# Django imports
|
# Django imports
|
||||||
from django.contrib.auth import login
|
from django.contrib.auth import login
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
# Module imports
|
# Module imports
|
||||||
from plane.authentication.utils.host import base_host
|
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):
|
def user_login(request, user, is_app=False, is_admin=False, is_space=False):
|
||||||
login(request=request, user=user)
|
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 = {
|
device_info = {
|
||||||
"user_agent": request.META.get("HTTP_USER_AGENT", ""),
|
"user_agent": request.META.get("HTTP_USER_AGENT", ""),
|
||||||
"ip_address": request.META.get("REMOTE_ADDR", ""),
|
"ip_address": request.META.get("REMOTE_ADDR", ""),
|
||||||
|
@ -331,7 +331,6 @@ SESSION_ENGINE = "plane.db.models.session"
|
|||||||
SESSION_COOKIE_AGE = 604800
|
SESSION_COOKIE_AGE = 604800
|
||||||
SESSION_COOKIE_NAME = "plane-session-id"
|
SESSION_COOKIE_NAME = "plane-session-id"
|
||||||
SESSION_COOKIE_DOMAIN = os.environ.get("COOKIE_DOMAIN", None)
|
SESSION_COOKIE_DOMAIN = os.environ.get("COOKIE_DOMAIN", None)
|
||||||
SESSION_SAVE_EVERY_REQUEST = True
|
|
||||||
|
|
||||||
# Admin Cookie
|
# Admin Cookie
|
||||||
ADMIN_SESSION_COOKIE_NAME = "plane-admin-session-id"
|
ADMIN_SESSION_COOKIE_NAME = "plane-admin-session-id"
|
||||||
|
Loading…
Reference in New Issue
Block a user