2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 20:46:47 +00:00

Fix for COOKIE_MODE in settings.py (#8268)

- Backport of https://github.com/inventree/InvenTree/pull/8262
This commit is contained in:
Oliver 2024-10-10 09:51:48 +11:00 committed by GitHub
parent 6c0f6e38d0
commit 933a5a5595
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1065,13 +1065,13 @@ COOKIE_MODE = (
.strip() .strip()
) )
valid_cookie_modes = {'lax': 'Lax', 'strict': 'Strict', 'none': None, 'null': None} valid_cookie_modes = {'lax': 'Lax', 'strict': 'Strict', 'none': 'None', 'null': 'None'}
if COOKIE_MODE not in valid_cookie_modes.keys(): if COOKIE_MODE not in valid_cookie_modes.keys():
logger.error('Invalid cookie samesite mode: %s', COOKIE_MODE) logger.error('Invalid cookie samesite mode: %s', COOKIE_MODE)
sys.exit(-1) sys.exit(-1)
COOKIE_MODE = valid_cookie_modes[COOKIE_MODE.lower()] COOKIE_MODE = valid_cookie_modes.get(COOKIE_MODE.lower(), 'None')
# Additional CSRF settings # Additional CSRF settings
CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN' CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'