fix: restore login throttling after lock expiry

This commit is contained in:
codex committed 2026-10-10 20:26:28 +03:00
1 parent a82f63d6cb
commit 96987e90c9
6 files changed
+19 -6

No files matched your search

+12
View File
@@ -205,7 +205,19 @@ def test_csrf_duplicate_user_validation_and_login_throttling(accounts):
assert login(client, user.username, 'Initial user password').status_code == 401
user.locked_until = utcnow() - timedelta(minutes=1)
db.commit()
for attempt in range(1, 6):
assert login(client, user.username, 'wrong password').status_code == 401
db.refresh(user)
assert user.failed_login_attempts == attempt
assert bool(user.locked_until) == (attempt == 5)
assert login(client, user.username, 'Initial user password').status_code == 401
db.refresh(user)
assert user.failed_login_attempts == 5
user.locked_until = utcnow() - timedelta(minutes=1)
db.commit()
assert login(client, user.username, 'Initial user password').status_code == 303
db.refresh(user)
assert user.failed_login_attempts == 0 and user.locked_until is None
def test_bootstrap_admin_first_login_and_changed_password_no_env_fallback(accounts):