mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Enhancement: set Django SESSION_EXPIRE_AT_BROWSER_CLOSE from PAPERLESS_ACCOUNT_SESSION_REMEMBER (#7748)
This commit is contained in:
		@@ -608,12 +608,14 @@ You can optionally also automatically redirect users to the SSO login with [PAPE
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#### [`PAPERLESS_ACCOUNT_SESSION_REMEMBER=<bool>`](#PAPERLESS_ACCOUNT_SESSION_REMEMBER) {#PAPERLESS_ACCOUNT_SESSION_REMEMBER}
 | 
					#### [`PAPERLESS_ACCOUNT_SESSION_REMEMBER=<bool>`](#PAPERLESS_ACCOUNT_SESSION_REMEMBER) {#PAPERLESS_ACCOUNT_SESSION_REMEMBER}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: Only applies to regular (non-SSO) accounts. See the corresponding
 | 
					: If false, sessions will expire at browser close, if true will use `PAPERLESS_SESSION_COOKIE_AGE` for expiration. See the corresponding
 | 
				
			||||||
[django-allauth documentation](https://docs.allauth.org/en/latest/account/configuration.html)
 | 
					[django-allauth documentation](https://docs.allauth.org/en/latest/account/configuration.html)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Defaults to True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### [`PAPERLESS_SESSION_COOKIE_AGE=<int>`](#PAPERLESS_SESSION_COOKIE_AGE) {#PAPERLESS_SESSION_COOKIE_AGE}
 | 
					#### [`PAPERLESS_SESSION_COOKIE_AGE=<int>`](#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
 | 
					: Login session cookie expiration. Applies if `PAPERLESS_ACCOUNT_SESSION_REMEMBER` is enabled. See the corresponding
 | 
				
			||||||
[django documentation](https://docs.djangoproject.com/en/5.1/ref/settings/#std-setting-SESSION_COOKIE_AGE)
 | 
					[django documentation](https://docs.djangoproject.com/en/5.1/ref/settings/#std-setting-SESSION_COOKIE_AGE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Defaults to 1209600 (2 weeks)
 | 
					    Defaults to 1209600 (2 weeks)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -473,6 +473,7 @@ ACCOUNT_EMAIL_VERIFICATION = os.getenv(
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ACCOUNT_SESSION_REMEMBER = __get_boolean("PAPERLESS_ACCOUNT_SESSION_REMEMBER", "True")
 | 
					ACCOUNT_SESSION_REMEMBER = __get_boolean("PAPERLESS_ACCOUNT_SESSION_REMEMBER", "True")
 | 
				
			||||||
 | 
					SESSION_EXPIRE_AT_BROWSER_CLOSE = not ACCOUNT_SESSION_REMEMBER
 | 
				
			||||||
SESSION_COOKIE_AGE = int(
 | 
					SESSION_COOKIE_AGE = int(
 | 
				
			||||||
    os.getenv("PAPERLESS_SESSION_COOKIE_AGE", 60 * 60 * 24 * 7 * 3),
 | 
					    os.getenv("PAPERLESS_SESSION_COOKIE_AGE", 60 * 60 * 24 * 7 * 3),
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user