fix:Mail-Einladung ohne Passwort
CI / audit (push) Skipped
CI / checks (push) Successful in 3m58s
CI / image (push) Successful in 1m8s

This commit is contained in:
marco.morath committed 2026-11-26 10:00:20 +01:00
1 parent 639f14fc2e
commit 481ccca5da
4 files changed
+50 -6

No files matched your search

+27
View File
@@ -194,3 +194,30 @@ def test_invitations_need_edit_rights(app: Any) -> None:
other = participant(app)
assert other.get(f"/forms/{pid}/invitations").status_code in (403, 404)
assert owner.get(f"/forms/{pid}/invitations").status_code == 200
def test_link_password_skipped_only_for_invited_accounts(app: Any) -> None:
from helpers import login
from surveybox.models import UserAccount
owner = creator(app)
participant(app) # paul@example.de
participant(app, "olga@example.de")
pid, token, _ = simple_form(owner, access="link_password", link_password="geheim123")
# Olga steht nur in der Zugriffsliste (z. B. von früher), Paul wird eingeladen
with Session(db.get_engine()) as s:
olga = s.scalar(select(UserAccount.id).where(UserAccount.email == "olga@example.de"))
s.add(FormAccessEntry(form_id=form_row(pid).id, user_id=olga))
s.commit()
set_form(pid, invite_accounts=False) # Zugriffsliste nicht automatisch einladen
invite(owner, pid, "paul@example.de")
paul, olga_client = new_client(app), new_client(app)
login(paul, "paul@example.de")
login(olga_client, "olga@example.de")
assert 'name="password"' in paul.get(f"/f/{token}").text # noch nicht eingeladen
assert run() == 1
page = paul.get(f"/f/{token}")
assert page.status_code == 200 and 'name="password"' not in page.text
page = olga_client.get(f"/f/{token}")
assert 'name="password"' in page.text # Eintrag in der Zugriffsliste genügt nicht