feat: new emails design

This commit is contained in:
fsylvain committed 2026-09-26 05:41:34 +02:00
1 parent 4e41d60142
commit 30a4df47b1
15 files changed
+498 -68

No files matched your search

@@ -28,8 +28,8 @@ Feature: Registration is only open while no verified account exists, and it send
both injected from config.Settings.PublicURL in api/dependecyInjection.go; the handler no longer
sends mail and no longer holds a SendMailUseCase or PublicURL itself
And after user.Repository.Create succeeds, CreateUserUseCase.CreateUser calls
mail.Repository.Send with the user's email, template "mailValidation"
(internal/infrastructure/mailer/templates/mailValidation.html, which renders a link from
mail.Repository.Send with the user's email, template "verification"
(internal/infrastructure/mailer/templates/verification.html, which renders a link from
"{{.Host}}/register/validate?c={{.VerificationCode}}"), and data whose Host is the injected public
URL and whose VerificationCode is the raw (unhashed) code
And if mail.Repository.Send returns an error, CreateUserUseCase.CreateUser deletes the
@@ -45,7 +45,7 @@ Feature: Registration is only open while no verified account exists, and it send
email "alice@example.com"
Then the response status is 200
And a jwt cookie is set
And exactly one email was sent to "alice@example.com" using template "mailValidation"
And exactly one email was sent to "alice@example.com" using template "verification"
And that email's data has VerificationCode equal to the raw code returned by CreateUser, not its
stored hash
@@ -100,7 +100,7 @@ Feature: Registration is only open while no verified account exists, and it send
When CreateUser is called with username "carol", password "hunter2example12",
email "carol@example.com"
Then the call succeeds and returns a user with IsVerified false
And exactly one email was sent to "carol@example.com" using template "mailValidation"
And exactly one email was sent to "carol@example.com" using template "verification"
Scenario: The create-user use case rolls back the user when the mail repository fails
Given an empty user.Repository fake