fix:Anzeige Sperre
CI / audit (push) Skipped
CI / checks (push) Successful in 3m46s
CI / image (push) Successful in 1m11s

This commit is contained in:
marco.morath committed 2026-11-26 09:18:47 +01:00
1 parent d718543169
commit 675a8cd6f2
14 files changed
+388 -123

No files matched your search

+23 -1
View File
@@ -64,7 +64,29 @@ def test_wrong_password_and_lockout(client: TestClient) -> None:
assert resp.status_code == 400
with Session(db.get_engine()) as s:
user = s.scalar(select(UserAccount).where(UserAccount.email == "anna@example.de"))
assert user is not None and user.locked_until is not None
assert user is not None and user.locked_until is not None and user.is_locked
def test_admin_sees_and_lifts_lock(app) -> None: # type: ignore[no-untyped-def]
from test_mail import admin
target, _ = make_user(Role.PARTICIPANT, "paula@example.de")
guest = new_client(app)
for _ in range(5):
assert login(guest, "paula@example.de", "falsches passwort!!").status_code == 400
root = admin(app)
listing = root.get("/admin/users").text
assert "temporarily locked" in listing
page = root.get(f"/admin/users/{target.public_id}").text
assert "5 failed sign-in attempts in a row" in page and "Lift lock" in page
resp = root.post(f"/admin/users/{target.public_id}/unlock",
data={"csrf_token": csrf_from(page)})
assert resp.status_code == 303 and "user_unlocked" in resp.headers["location"]
assert "Lift lock" not in root.get(f"/admin/users/{target.public_id}").text
assert login(guest, "paula@example.de").status_code == 303
with Session(db.get_engine()) as s:
actions = list(s.scalars(select(AuditEvent.action)))
assert "auth.locked" in actions and "admin.user_unlocked" in actions
def test_unknown_user_gets_same_answer(client: TestClient) -> None: