Skip to content

Commit

Permalink
make sessions expire
Browse files Browse the repository at this point in the history
  • Loading branch information
nextgens committed Mar 9, 2021
1 parent a1d3256 commit b9becd8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/admin/mailu/configuration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os

from datetime import timedelta
from socrate import system

DEFAULT_CONFIG = {
Expand Down Expand Up @@ -53,6 +54,7 @@
'RECAPTCHA_PRIVATE_KEY': '',
# Advanced settings
'LOG_LEVEL': 'WARNING',
'SESSION_LIFETIME': 24,
'SESSION_COOKIE_SECURE': True,
'CREDENTIAL_ROUNDS': 12,
# Host settings
Expand Down Expand Up @@ -136,6 +138,7 @@ def init_app(self, app):
self.config['SESSION_COOKIE_SAMESITE'] = 'Strict'
self.config['SESSION_COOKIE_HTTPONLY'] = True
self.config['SESSION_KEY_BITS'] = 128
self.config['PERMANENT_SESSION_LIFETIME'] = timedelta(hours=int(self.config['SESSION_LIFETIME']))
# update the app config itself
app.config = self

Expand Down
2 changes: 2 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

``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.
Log messages equal or higher than this priority will be printed.
Can be one of: CRITICAL, ERROR, WARNING, INFO, DEBUG or NOTSET.
Expand Down

0 comments on commit b9becd8

Please sign in to comment.