From 67f52888f62ced2cbb0cb2a957a4d21cb70f3c8c Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 26 Nov 2018 10:30:40 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E6=B5=8F=E8=A7=88=E5=99=A8=E4=BC=9A?= =?UTF-8?q?=E8=AF=9D=E7=81=AB=E6=B0=94=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jumpserver/conf.py | 1 + apps/jumpserver/settings.py | 1 + config_example.py | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index bbf02498b..ec5111e1b 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -310,6 +310,7 @@ defaults = { 'SESSION_COOKIE_DOMAIN': None, 'CSRF_COOKIE_DOMAIN': None, 'SESSION_COOKIE_AGE': 3600 * 24, + 'SESSION_EXPIRE_AT_BROWSER_CLOSE': False, 'AUTH_OPENID': False, 'EMAIL_SUFFIX': 'jumpserver.org' } diff --git a/apps/jumpserver/settings.py b/apps/jumpserver/settings.py index 1d7a2a8de..9ed022df9 100644 --- a/apps/jumpserver/settings.py +++ b/apps/jumpserver/settings.py @@ -146,6 +146,7 @@ LOGIN_URL = reverse_lazy('users:login') SESSION_COOKIE_DOMAIN = CONFIG.SESSION_COOKIE_DOMAIN CSRF_COOKIE_DOMAIN = CONFIG.CSRF_COOKIE_DOMAIN SESSION_COOKIE_AGE = CONFIG.SESSION_COOKIE_AGE +SESSION_EXPIRE_AT_BROWSER_CLOSE = CONFIG.SESSION_EXPIRE_AT_BROWSER_CLOSE MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage' # Database diff --git a/config_example.py b/config_example.py index d2255a0d9..dfcc876a3 100644 --- a/config_example.py +++ b/config_example.py @@ -44,6 +44,11 @@ class Config: # LOG_LEVEL = 'DEBUG' # LOG_DIR = os.path.join(BASE_DIR, 'logs') + # Session expiration setting, Default 24 hour, Also set expired on on browser close + # 浏览器Session过期时间,默认24小时, 也可以设置浏览器关闭则过期 + # SESSION_COOKIE_AGE = 3600 * 24 + # SESSION_EXPIRE_AT_BROWSER_CLOSE = False + # Database setting, Support sqlite3, mysql, postgres .... # 数据库设置 # See https://docs.djangoproject.com/en/1.10/ref/settings/#databases