Skip to content

feat(passkeys): Add postAddPasskey email template#20305

Merged
vpomerleau merged 2 commits intomainfrom
FXA-13367
Apr 9, 2026
Merged

feat(passkeys): Add postAddPasskey email template#20305
vpomerleau merged 2 commits intomainfrom
FXA-13367

Conversation

@vpomerleau
Copy link
Copy Markdown
Contributor

@vpomerleau vpomerleau commented Apr 2, 2026

Because

  • We want to send a security notification to users when a passkey is added to their account

This pull request

  • Add a new email footer partial with action items if the new passkey is unexpected
  • Add new email template
  • Sets up email send when passkey registration is successful
  • Removes duplicated support links in plain text email templates (separate commit)

Issue that this pull request solves

Closes: FXA-13367

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on:
  • Suggested review order:
  • Risky or complex parts:

Screenshots (Optional)

See storybook:
https://mozilla.github.io/fxa/storybooks/pr-20305/email-renderer/?path=/story/fxa-emails-templates-postaddpasskey--post-add-passkey

Other information (Optional)

The "learn more" url is a placeholder, we don't have a support article yet.

Comment thread libs/accounts/email-renderer/src/partials/automatedEmailSignIn/en.ftl Outdated
@vpomerleau vpomerleau force-pushed the FXA-13367 branch 2 times, most recently from c699351 to 5ec1d3f Compare April 2, 2026 18:58
@vpomerleau vpomerleau changed the title Fxa 13367 feat(passkeys): Add postAddPasskey email template Apr 2, 2026
@vpomerleau vpomerleau marked this pull request as ready for review April 2, 2026 20:05
@vpomerleau vpomerleau requested review from a team as code owners April 2, 2026 20:05
Copy link
Copy Markdown
Contributor

@bcolsson bcolsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues with the strings here, but wondering if this needs to be added to the gruntfile.js to make sure these are extracted for localization?

@vpomerleau vpomerleau force-pushed the FXA-13367 branch 3 times, most recently from 88268e9 to 97d99a6 Compare April 7, 2026 18:30
Copy link
Copy Markdown
Contributor

@vbudhram vbudhram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code and storybook look good, :shipit:

Comment thread packages/fxa-auth-server/lib/senders/fxa-mailer-sanity-check.ts Outdated
Comment thread libs/accounts/email-renderer/gruntfile.js
'https://privacyportal.onetrust.com/webform/1350748f-7139-405c-8188-22740b3b5587/4ba08202-2ede-4934-a89e-f0b0870f95f0',
'https://support.mozilla.org/kb/secure-mozilla-account-two-step-authentication',
},
// TODO: Replace with dedicated passkeys support article URL when available
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, do we have a ticket for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a draft in progress with https://mozilla-hub.atlassian.net/browse/FXA-12709 but the official request isn't filed yet.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “postAddPasskey” security notification email and wires it into the passkey registration success flow, including new support/security links used by the template.

Changes:

  • Added postAddPasskey email template (HTML + plaintext), plus a new automatedEmailSignIn footer partial.
  • Triggered sending the new email on successful passkey registration (/passkey/registration/finish), with tests.
  • Extended link/config plumbing for passkey/support/security URLs and removed duplicate support links from several plaintext templates.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/fxa-auth-server/lib/senders/fxa-mailer.ts Adds sendPostAddPasskeyEmail and link construction for the new template.
packages/fxa-auth-server/lib/senders/fxa-mailer-sanity-check.ts Adds a typed sanity-check invocation for the new mailer method.
packages/fxa-auth-server/lib/routes/passkeys.ts Sends the post-add-passkey email after successful passkey registration (errors swallowed + logged).
packages/fxa-auth-server/lib/routes/passkeys.spec.ts Adds tests covering email send behavior (success/failure/canSend/error swallow).
packages/fxa-auth-server/config/index.ts Adds new SMTP config keys for passkey/review-activity support URLs and sets derived defaults.
packages/fxa-admin-server/src/config/index.ts Adds matching config keys + corrects twoFactorSupportUrl documentation/default.
libs/accounts/email-renderer/src/templates/postSigninRecoveryPhone/index.txt Removes duplicated plaintext support partial include.
libs/accounts/email-renderer/src/templates/postSigninRecoveryCode/index.txt Removes duplicated plaintext support partial include.
libs/accounts/email-renderer/src/templates/postRemoveRecoveryPhone/index.txt Removes duplicated plaintext support partial include.
libs/accounts/email-renderer/src/templates/postChangeRecoveryPhone/index.txt Removes duplicated plaintext support partial include.
libs/accounts/email-renderer/src/templates/postAddRecoveryPhone/index.txt Removes duplicated plaintext support partial include.
libs/accounts/email-renderer/src/templates/postAddPasskey/index.txt Adds plaintext template for “passkey created” email.
libs/accounts/email-renderer/src/templates/postAddPasskey/index.ts Registers template metadata + TemplateData type.
libs/accounts/email-renderer/src/templates/postAddPasskey/index.stories.ts Adds Storybook stories (with/without Sync note).
libs/accounts/email-renderer/src/templates/postAddPasskey/index.mjml Adds HTML template for “passkey created” email.
libs/accounts/email-renderer/src/templates/postAddPasskey/en.ftl Adds Fluent strings for the new template.
libs/accounts/email-renderer/src/templates/passwordResetRecoveryPhone/index.txt Removes duplicated plaintext support partial include.
libs/accounts/email-renderer/src/templates/passwordReset/index.txt Removes duplicated plaintext support partial include.
libs/accounts/email-renderer/src/templates/passwordChanged/index.txt Removes duplicated plaintext support partial include.
libs/accounts/email-renderer/src/templates/index.ts Exports postAddPasskey template module.
libs/accounts/email-renderer/src/renderer/fxa-email-renderer.ts Adds renderPostAddPasskey renderer method.
libs/accounts/email-renderer/src/renderer/fxa-email-renderer.spec.ts Adds snapshot tests for postAddPasskey (with/without Sync note).
libs/accounts/email-renderer/src/renderer/email-link-builder.ts Adds campaign/content mappings and new link helpers (security settings + support URLs).
libs/accounts/email-renderer/src/renderer/email-link-builder.spec.ts Adds unit tests for the new link-builder methods/config.
libs/accounts/email-renderer/src/renderer/snapshots/fxa-email-renderer.spec.ts.snap Adds snapshots for the new rendered email.
libs/accounts/email-renderer/src/partials/automatedEmailSignIn/index.txt Adds new plaintext footer partial for “review security settings / support” guidance.
libs/accounts/email-renderer/src/partials/automatedEmailSignIn/index.ts Adds TemplateData type for the new footer partial.
libs/accounts/email-renderer/src/partials/automatedEmailSignIn/index.stories.ts Adds Storybook story for the new footer partial.
libs/accounts/email-renderer/src/partials/automatedEmailSignIn/index.mjml Adds MJML footer partial content.
libs/accounts/email-renderer/src/partials/automatedEmailSignIn/en.ftl Adds Fluent strings for the new footer partial.
libs/accounts/email-renderer/gruntfile.js Registers new FTL files for build/packaging.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/fxa-auth-server/config/index.ts Outdated
<%- include('/partials/userInfo/index.txt') %>

<%- include('/partials/automatedEmailResetPassword/index.txt') %>
<%- include('/partials/support/index.txt') %>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. I feel like the real issue is that automatedEmailResetPassword/index.txt repeats the 'For more info, visit Mozilla Support:string that belongs to/partials/support/index.txt. Can we remove the support verbiage from automatedEmailResetPassword/index.txt` instead?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe that'd also need to be done in the mjml files... Feel free to treat this as a nit / optional feedback. This is probably the most direct thing to do for time being. Alternatively, this fix should probably be done in a separate PR.

Because:

* We want to send a security notification to users when a passkey is added to their account

This commit:

* Add a new email footer partial with action items if the new passkey is unexpected
* Add new email template
* Sets up email send when passkey registration is successful

Closes #FXA-13367
@vpomerleau vpomerleau merged commit 62e0d5b into main Apr 9, 2026
21 checks passed
@vpomerleau vpomerleau deleted the FXA-13367 branch April 9, 2026 19:27
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.

5 participants