mirror of
				https://github.com/optim-enterprises-bv/Mailu.git
				synced 2025-11-03 19:47:52 +00:00 
			
		
		
		
	make sessions expire
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from datetime import timedelta
 | 
				
			||||||
from socrate import system
 | 
					from socrate import system
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DEFAULT_CONFIG = {
 | 
					DEFAULT_CONFIG = {
 | 
				
			||||||
@@ -53,6 +54,7 @@ DEFAULT_CONFIG = {
 | 
				
			|||||||
    'RECAPTCHA_PRIVATE_KEY': '',
 | 
					    'RECAPTCHA_PRIVATE_KEY': '',
 | 
				
			||||||
    # Advanced settings
 | 
					    # Advanced settings
 | 
				
			||||||
    'LOG_LEVEL': 'WARNING',
 | 
					    'LOG_LEVEL': 'WARNING',
 | 
				
			||||||
 | 
					    'SESSION_LIFETIME': 24,
 | 
				
			||||||
    'SESSION_COOKIE_SECURE': True,
 | 
					    'SESSION_COOKIE_SECURE': True,
 | 
				
			||||||
    'CREDENTIAL_ROUNDS': 12,
 | 
					    'CREDENTIAL_ROUNDS': 12,
 | 
				
			||||||
    # Host settings
 | 
					    # Host settings
 | 
				
			||||||
@@ -136,6 +138,7 @@ class ConfigManager(dict):
 | 
				
			|||||||
        self.config['SESSION_COOKIE_SAMESITE'] = 'Strict'
 | 
					        self.config['SESSION_COOKIE_SAMESITE'] = 'Strict'
 | 
				
			||||||
        self.config['SESSION_COOKIE_HTTPONLY'] = True
 | 
					        self.config['SESSION_COOKIE_HTTPONLY'] = True
 | 
				
			||||||
        self.config['SESSION_KEY_BITS'] = 128
 | 
					        self.config['SESSION_KEY_BITS'] = 128
 | 
				
			||||||
 | 
					        self.config['PERMANENT_SESSION_LIFETIME'] = timedelta(hours=int(self.config['SESSION_LIFETIME']))
 | 
				
			||||||
        # update the app config itself
 | 
					        # update the app config itself
 | 
				
			||||||
        app.config = self
 | 
					        app.config = self
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -142,6 +142,8 @@ The ``CREDENTIAL_ROUNDS`` (default: 12) setting is the number of rounds used by
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
The ``SESSION_COOKIE_SECURE`` (default: True) setting controls the secure flag on the cookies of the administrative interface. It should only be turned off if you intend to access it over plain HTTP.
 | 
					The ``SESSION_COOKIE_SECURE`` (default: True) setting controls the secure flag on the cookies of the administrative interface. It should only be turned off if you intend to access it over plain HTTP.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					``SESSION_LIFETIME`` (default: 24) is the length in hours a session is valid for on the administrative interface.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The ``LOG_LEVEL`` setting is used by the python start-up scripts as a logging threshold.
 | 
					The ``LOG_LEVEL`` setting is used by the python start-up scripts as a logging threshold.
 | 
				
			||||||
Log messages equal or higher than this priority will be printed.
 | 
					Log messages equal or higher than this priority will be printed.
 | 
				
			||||||
Can be one of: CRITICAL, ERROR, WARNING, INFO, DEBUG or NOTSET.
 | 
					Can be one of: CRITICAL, ERROR, WARNING, INFO, DEBUG or NOTSET.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user