Skip to content

feat(auth-server): copy local email codes to the clipboard#20922

Open
nshirley wants to merge 1 commit into
mainfrom
inbox-code-watcher
Open

feat(auth-server): copy local email codes to the clipboard#20922
nshirley wants to merge 1 commit into
mainfrom
inbox-code-watcher

Conversation

@nshirley

@nshirley nshirley commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Because

  • I'm too lazy to copy/paste and forget to tail inbox pm2 logs

This pull request

  • Adds an opt-in MAIL_HELPER_COPY_CODES=1 flag to packages/fxa-auth-server/test/mail_helper.js that copies each code to the local clipboard as it arrives, so it can be pasted straight into the browser.
  • Copies at the point the code is already in hand, covering signin, token, unblock, password reset, MFA, passwordless signup/signin, and the Redis-polled recovery phone OTP.
  • Logs Clipboard copy: enabled (pbcopy) / disabled on startup next to mail_helper started..., so a missing env var is diagnosable at a glance rather than looking like a broken feature.
  • Documents the inbox service and the new flag under a "Local emails and codes" section in packages/fxa-auth-server/README.md, which previously had no mention of how to retrieve a code locally.

Issue that this pull request solves

Closes: N/A

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)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

The flag is off by default, so CI and local functional-test runs are unaffected — copyCode() returns immediately unless MAIL_HELPER_COPY_CODES=1, and no clipboard process is spawned. It resolves pbcopy / xclip / clip by platform and silently no-ops if the tool is missing, so it cannot take the mail helper down.

No Jira ticket: local dev-tooling only, with no production code path or user-facing behaviour. No pre-merge review skill was run for the same reason.

@nshirley
nshirley marked this pull request as ready for review July 24, 2026 23:17
@nshirley
nshirley requested a review from a team as a code owner July 24, 2026 23:17
Copilot AI review requested due to automatic review settings July 24, 2026 23:17

Copilot AI left a comment

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.

Pull request overview

Adds an opt-in local-dev enhancement to the auth-server mail helper to copy incoming authentication codes to the system clipboard, and documents how to use the local “inbox” mail capture service.

Changes:

  • Add MAIL_HELPER_COPY_CODES=1 flag support to test/mail_helper.js, including platform-specific clipboard integration and startup status logging.
  • Copy received codes to the clipboard for multiple flows (signin/token/unblock/password reset/MFA/passwordless/recovery phone).
  • Document local email/code retrieval workflow and the new flag in the auth-server README.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/fxa-auth-server/test/mail_helper.js Adds clipboard-copy feature gated by MAIL_HELPER_COPY_CODES, and invokes it when codes are received.
packages/fxa-auth-server/README.md Documents the local “inbox” mail helper service and how to enable clipboard copying of codes.

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

Comment on lines +138 to +142
} else if (vc) {
console.log('\x1B[32m', link || vc, '\x1B[39m');
} else if (sc) {
console.log('\x1B[32mToken code: ', sc, '\x1B[39m');
copyCode(sc);
Comment thread packages/fxa-auth-server/test/mail_helper.js
Comment thread packages/fxa-auth-server/README.md Outdated

@vpomerleau vpomerleau left a comment

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 this dev improvement 🪄 No comments beyond the copilot ones.

Because:

* I got tired of copy/pasting codes between the terminal and the browser.

This commit:

* Adds MAIL_HELPER_COPY_CODES=1 to mail_helper, which copies each code to
  the local clipboard as it arrives. Off by default.
* Copies whatever the helper logs, so flows that send a verification link
  instead of a code are covered too.
* Logs the clipboard mode on startup so a missing env var is obvious.
* Documents the inbox service and the new flag in the auth-server README,
  including a caution about clipboard history tools.
@nshirley
nshirley force-pushed the inbox-code-watcher branch from a4920cf to 63860a9 Compare July 25, 2026 01:01
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.

3 participants