]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Enhancement: allow setting session cookie age (#7743)
authorshamoon <4887959+shamoon@users.noreply.github.com>
Fri, 20 Sep 2024 01:58:40 +0000 (18:58 -0700)
committerGitHub <noreply@github.com>
Fri, 20 Sep 2024 01:58:40 +0000 (18:58 -0700)
docs/configuration.md
src/paperless/settings.py

index 3530849ddb70f43f2782b1dca621e4957e6617fb..301e86fc238a8dfa4f68eb5548ff915f3bf1e09b 100644 (file)
@@ -611,6 +611,13 @@ You can optionally also automatically redirect users to the SSO login with [PAPE
 : Only applies to regular (non-SSO) accounts. See the corresponding
 [django-allauth documentation](https://docs.allauth.org/en/latest/account/configuration.html)
 
+#### [`PAPERLESS_SESSION_COOKIE_AGE=<bool>`](#PAPERLESS_SESSION_COOKIE_AGE) {#PAPERLESS_SESSION_COOKIE_AGE}
+
+: Default login cookie expiration. Applies to regular logins if remember is enabled and always for SSO logins. See the corresponding
+[django documentation](https://docs.djangoproject.com/en/5.1/ref/settings/#std-setting-SESSION_COOKIE_AGE)
+
+    Defaults to 1209600 (2 weeks)
+
 ## OCR settings {#ocr}
 
 Paperless uses [OCRmyPDF](https://ocrmypdf.readthedocs.io/en/latest/)
index ebe64ba9ec1f2ab7342a31608f935e03e55b0173..9a57719a2815563381abd1980bf5269de1339699 100644 (file)
@@ -472,7 +472,10 @@ ACCOUNT_EMAIL_VERIFICATION = os.getenv(
     "optional",
 )
 
-ACCOUNT_SESSION_REMEMBER = __get_boolean("PAPERLESS_ACCOUNT_SESSION_REMEMBER")
+ACCOUNT_SESSION_REMEMBER = __get_boolean("PAPERLESS_ACCOUNT_SESSION_REMEMBER", "True")
+SESSION_COOKIE_AGE = int(
+    os.getenv("PAPERLESS_SESSION_COOKIE_AGE", 60 * 60 * 24 * 7 * 3),
+)
 
 if AUTO_LOGIN_USERNAME:
     _index = MIDDLEWARE.index("django.contrib.auth.middleware.AuthenticationMiddleware")