A failed confirmation resend is invisible to us and leaves the user locked out #61
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The resend path starts a task, throws the result away, and returns
:okwhatever happened. When the mailer rejects the message (a rotated key returns 401, or 429, or a 5xx) the page still promises instructions, and because login is refused until the address is confirmed that user cannot use the site at all. The resend has already replaced the outstanding token, so the previously delivered link stops working too. Registration and password reset both log this same failure, so only this path is blind.Evidence
At
2f150f66:lib/aprsme/accounts.ex:518is_task = Task.start(fn -> UserNotifier.deliver_confirmation_instructions(user, url) end), and:519returns:okunconditionally.lib/aprsme/accounts.ex:517mints the URL first, which deletes the previous token.lib/aprsme/accounts.ex:571logsconfirmation mail delivery failed user_id=...on the registration path and:682does the same for password reset.lib/aprsme_web/live/user_confirmation_instructions_live.ex:102still renders the promise that instructions are on the way.Expected
The failure is logged keyed on the user id the way the sibling paths do, and the previous token is only replaced once the new mail was accepted, or the failure is surfaced.
How to verify
Configure the mailer to return
{:error, :rejected}, submit the resend form for a known unconfirmed address, and assert withExUnit.CaptureLogthat an error naming the user id is emitted. Today no line appears.Acceptance criteria
Effort: S
Lens: product