Repository navigation
Conversation
When the mailer rejects an email change, the 400 response quoted the user's current email instead of the address being confirmed. For an anonymous user linking an email for the first time this produced `Email address "" is invalid`, and for other users it pointed at their existing address rather than the new one. Fixes supabase#2847
|
I ran this against a local server: auth built from the
All of them are 400 The third row is the case from your second note, run for real. The current address is the one the check rejects. Tests: I used an AI assistant (Claude Code) to write the test scripts and help with this write-up. I ran everything on my own machine and checked the output. |
|
Thanks for testing both recipients and sharing the results. Commit |
|
Thanks for the fix. I re-ran it on
So it now names the address that actually failed in every case I tried. The accepted changes (anonymous user linking an address, user with both addresses valid) still return 200 on all three builds, and the stored rows match too.
One thing is still different. When both addresses fail the check, the message names whichever goroutine in What I didn't test: the full |
|
Thanks for checking both validation paths and the successful changes. I'd keep the existing first-error behavior when both addresses fail. Each response still names an address the validator rejected, and guaranteeing that the new address wins would change when the mailer returns and cancels the other send. This PR stays focused on reporting the rejected recipient. The separate delivery behavior is tracked in #2948. |
|
One follow-up on the interaction with #2949. I verified that the three rejected-recipient cases pass on this PR head ( I verified a small integration fix locally. Have |
|
Thanks for checking the combination. I reproduced it here with the race detector and got the same result:
Since One side effect of the combination: when both addresses are rejected, the response always names the new address (50 of 50 runs). That's because #2949 checks the addresses in order before either mail is sent, so nothing has been sent or cancelled yet. On this PR alone it names either address (26 current, 24 new over 50 runs). |
|
A follow-up to my comment above: #2949 now has a second commit, It changes the same lines of
The plan from my comment above stands. |
|
Thanks for the follow-up. I combined this head ( That merge plan works for me. If #2949 lands first, I'll carry that resolution here. If this PR lands first, the integration can go into #2949. |
What
Fixes #2847.
When the mailer rejects an address during an email change (
PUT /user), the 400 response now names the address the mail validator rejected. This covers the new address, including when an anonymous user links an email, and the current address when secure email change sends to both.How
The validation mail client retains the rejected recipient alongside the original validation error.
sendEmailuses that recipient when returningemail_address_invalid. The original validation error remains available througherrors.Is, and the response status and error code are unchanged.Testing
gofmtandgit diff --checkpassed.