Skip to content

Send confirmation to pending email with reconfirmation-specific copy#1417

Open
maebeale wants to merge 4 commits intomainfrom
maebeale/1414-resend-to-pending-email
Open

Send confirmation to pending email with reconfirmation-specific copy#1417
maebeale wants to merge 4 commits intomainfrom
maebeale/1414-resend-to-pending-email

Conversation

@maebeale
Copy link
Collaborator

What is the goal of this PR and why is this important?

  • When an admin changes a user's email, the confirmation email was sent to the old email instead of the new (pending) one
  • The confirmation email used welcome/invite copy ("Set your password") even for existing users confirming an email change — confusing for the recipient

How did you approach the change?

  • Override send_confirmation_instructions on User to always route to unconfirmed_email when present, rather than relying on Devise's pending_reconfirmation? check
  • Branch the DeviseMailer confirmation_instructions subject line: welcome vs reconfirmation
  • Branch the HTML and text email templates with appropriate copy for each scenario:
    • Welcome invite (new users): unchanged — "Welcome to the AWBW Portal!", "Set your password"
    • Reconfirmation (email change): "Confirm your new email", shows the new email address, safe-to-ignore note
  • Add mailer specs covering both branches (subject, body content, new email shown)

UI Testing Checklist

  • Create a new user → they receive the welcome invite email with "Set your password"
  • Change an existing confirmed user's email → confirmation email goes to the new email with "Confirm your new email" copy
  • Use "Resend confirmation email" on confirm_email_manual page for a pending email change → email goes to the pending email
  • Use the interstitial "Continue" button after email change → email goes to the pending email

Anything else to add?

  • The ProcessEmailManualConfirm and ProcessEmailChange services both call send_confirmation_instructions, so the User model override fixes both flows in one place

🤖 Generated with Claude Code

maebeale and others added 2 commits March 12, 2026 21:35
Override Devise's send_confirmation_instructions on User to always
route to unconfirmed_email when present, fixing flows where the
confirmation was sent to the old email instead of the new one.

Branch the confirmation email subject, HTML, and text templates:
- Welcome invite (new users): unchanged
- Reconfirmation (email change): new subject, CTA, and copy

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add User model spec for send_confirmation_instructions override
verifying it routes to unconfirmed_email when present.

Update ProcessEmailChange and ProcessEmailManualConfirm specs to
assert the DeviseMailer receives the correct `to:` address rather
than just checking that send_confirmation_instructions was called.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maebeale maebeale marked this pull request as ready for review March 13, 2026 02:01
maebeale and others added 2 commits March 12, 2026 22:21
Ensure DeviseMailer stub is set up after user factory creation so
the on-create confirmation email doesn't inflate the mock count.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant