feat: resend account activation email endpoint#321
Open
hhvrc wants to merge 1 commit into
Open
Conversation
Adds POST /{version}/account/activate/resend so users can request a fresh
activation email. The endpoint:
- rotates the activation token (invalidating any previously sent link) and
persists it before sending, so the emailed link matches the stored hash
- creates an activation request if the unactivated account lacks one (e.g.
legacy data or a failed initial send)
- silently no-ops for unknown, already-activated, or deactivated accounts and
always returns a generic 200, so it can't be used to probe account state
- is rate limited under the existing "auth" policy and tracks EmailSendAttempts
No database migration required (reuses the existing UserActivationRequest table).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Ready to review this PR? Stage has broken it down into 4 individual chapters for you:
Chapters generated by Stage for commit 105d509 on Jun 24, 2026 7:58am UTC. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a user-facing action to re-send the account activation email, so users who never received (or lost) their activation email can request a new one. No database migration required — it reuses the existing
UserActivationRequesttable.This is the first, deliberately small slice of a larger email-features effort (admin send-any-email-type, list email types, and an upstream-failure retry queue will follow in separate PRs).
Endpoint
POST /{version}/account/activate/resend{ "email": "user@example.com" }Always returns a generic
200 OK(LegacyEmptyResponse).Behavior
200— the endpoint can't be used to probe which emails are registered or their activation state.authpolicy (mirrorsPOST /account/reset).UserActivationRequest.EmailSendAttemptsfor observability (the column already existed and was unused).Tests
Added integration tests (
MailTests.cs, delivered via the Mailpit SMTP test server):ResendActivation_UnactivatedUser_SendsWorkingActivationEmail— create-request path; the resent link actually activates the account.ResendActivation_RotatesToken_PreviousLinkInvalidated— after a resend, the original token returns400and the fresh token returns200.ResendActivation_AlreadyActivatedUser_Returns200_AndSendsNoEmailResendActivation_UnknownEmail_Returns200_AndSendsNoEmailAll 4 pass locally.
🤖 Generated with Claude Code