From 1c86102d82c98fa2c51c81c5a141e1de5a177cea Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Tue, 11 Aug 2026 23:46:45 +0200 Subject: [PATCH] refactor fail limit to match allauth defaults more closely (#12623) --- .github/workflows/frontend.yaml | 1 - src/backend/InvenTree/InvenTree/settings.py | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/frontend.yaml b/.github/workflows/frontend.yaml index e7a2be4117..a7b5a704e2 100644 --- a/.github/workflows/frontend.yaml +++ b/.github/workflows/frontend.yaml @@ -32,7 +32,6 @@ env: INVENTREE_STATIC_ROOT: /home/runner/work/InvenTree/test_inventree_static INVENTREE_BACKUP_DIR: /home/runner/work/InvenTree/test_inventree_backup INVENTREE_SITE_URL: http://localhost:8000 - INVENTREE_LOGIN_ATTEMPTS: 25 permissions: contents: read diff --git a/src/backend/InvenTree/InvenTree/settings.py b/src/backend/InvenTree/InvenTree/settings.py index 2df3d87587..b42351035b 100644 --- a/src/backend/InvenTree/InvenTree/settings.py +++ b/src/backend/InvenTree/InvenTree/settings.py @@ -1012,13 +1012,11 @@ USERSESSIONS_TRACK_ACTIVITY = True # allauth rate limiting: https://docs.allauth.org/en/latest/account/rate_limits.html # The default login rate limit is "5/m/user,5/m/ip,5/m/key" login_attempts = get_setting('INVENTREE_LOGIN_ATTEMPTS', 'login_attempts', 5) - try: - login_attempts = int(login_attempts) - login_attempts = f'{login_attempts}/m,{login_attempts}/m' + # Only the per-account ('key') limit is user-configurable with an int - use a str for more custom limits + login_attempts = f'10/m/ip,{int(login_attempts)}/m/key' except ValueError: # pragma: no cover pass - ACCOUNT_RATE_LIMITS = {'login_failed': login_attempts} # Default protocol for login