Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/server/oasisapi/hashers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.contrib.auth.hashers import PBKDF2PasswordHasher


class FastPBKDF2PasswordHasher(PBKDF2PasswordHasher):
# Django 3.2 had a count of ~260,000 by default, which was upped to 870,000 for Django 5.1.
iterations = 260000
5 changes: 5 additions & 0 deletions src/server/oasisapi/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,18 @@
IS_TESTSERVER = len(sys.argv) >= 2 and sys.argv[1] == 'runserver'
IS_SWAGGER_GEN = len(sys.argv) >= 2 and sys.argv[1] == 'generate_swagger'


if IS_UNITTEST or IS_TESTSERVER:
# Always set Debug mode when in dev environment
MEDIA_ROOT = './shared-fs/'
DEBUG = True
DEBUG_TOOLBAR = True
URL_SUB_PATH = False
CONSOLE_DEBUG = True # disable celery / db checks in health check
# Adds custom password hasher as Django 5 has >3x default iterations compared to Django 3, which slows down existing test cases signficantly
PASSWORD_HASHERS = [
'src.server.oasisapi.hashers.FastPBKDF2PasswordHasher',
]
else:
# SECURITY WARNING: don't run with debug turned on in production!
MEDIA_ROOT = iniconf.settings.get('server', 'media_root', fallback=os.path.join(BASE_DIR, 'media'))
Expand Down
Loading