feat(auth): email de confirmation de changement d'adresse (#73)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Colin Maudry
2026-06-24 18:45:37 +02:00
parent 4602b45f30
commit 90261d4f31
2 changed files with 16 additions and 0 deletions
+5
View File
@@ -63,3 +63,8 @@ def send_verification_email(email: str, token: str) -> None:
def send_reset_email(email: str, token: str) -> None: def send_reset_email(email: str, token: str) -> None:
link = f"{_base_url()}/reinitialiser-mot-de-passe?token={token}" link = f"{_base_url()}/reinitialiser-mot-de-passe?token={token}"
_send_template(_template_id("BREVO_TEMPLATE_RESET_ID"), email, {"link": link}) _send_template(_template_id("BREVO_TEMPLATE_RESET_ID"), email, {"link": link})
def send_email_change_email(email: str, token: str) -> None:
link = f"{_base_url()}/auth/confirm-email-change?token={token}"
_send_template(_template_id("BREVO_TEMPLATE_VERIFY_ID"), email, {"link": link})
+11
View File
@@ -61,3 +61,14 @@ def test_send_without_init_raises(monkeypatch):
monkeypatch.setenv("BREVO_TEMPLATE_VERIFY_ID", "11") monkeypatch.setenv("BREVO_TEMPLATE_VERIFY_ID", "11")
with pytest.raises(AssertionError): with pytest.raises(AssertionError):
mailer.send_verification_email("a@b.c", "TOKEN123") mailer.send_verification_email("a@b.c", "TOKEN123")
def test_send_email_change_email(fake_client):
mailer.send_email_change_email("new@example.fr", "tok123")
calls = fake_client.transactional_emails.calls
assert len(calls) == 1
call = calls[0]
assert call["template_id"] == 11
assert call["to"][0].email == "new@example.fr"
assert "/auth/confirm-email-change?token=tok123" in call["params"]["link"]