mirror of
https://github.com/inventree/InvenTree.git
synced 2026-08-13 00:46:15 +00:00
refactor fail limit to match allauth defaults more closely (#12623)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user