refactor fail limit to match allauth defaults more closely (#12623)

This commit is contained in:
Matthias Mair
2026-08-12 07:46:45 +10:00
committed by GitHub
parent 40c528164f
commit 1c86102d82
2 changed files with 2 additions and 5 deletions
-1
View File
@@ -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
+2 -4
View File
@@ -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