Skip to content

fix(site): send portal sign-in codes and magic links via Cloudflare Email Sending - #821

Merged
codercatdev merged 2 commits into
devfrom
fix/portal-otp-email
Nov 7, 2026
Merged

codercatdev merged 2 commits into
devfrom
fix/portal-otp-email

Conversation

@codercatdev

Copy link
Copy Markdown
Contributor

Problem

Sign-in codes on /portal/[token] (e.g. https://codingcat.dev/portal/spt_b0e6532361bf4052) and /sign-in never arrive. 656d9e6 stubbed sendCodingCatEmailDetailed to return ok: false to stop automated outreach. The Better Auth OTP and magic-link handlers ignored that return value, so the UI said "Sent a 6-digit verification code" while nothing was sent.

Fix

  • New sendCodingCatAuthEmail in lib/email.ts sends through the EMAIL binding (Cloudflare Email Sending; codingcat.dev is onboarded and enabled) from noreply@codingcat.dev.
  • It throws on failure (logging only the Email Sending error code, never the OTP), so the portal shows an error instead of a phantom success.
  • sendVerificationOTP and sendMagicLink in lib/auth.ts use it.
  • Outreach email (sendCodingCatEmail) stays disabled.

Verification

  • wrangler email sending send --from noreply@codingcat.dev → queued.
  • astro check: no new errors in the touched files (remaining errors are the pre-existing missing Worker types).
  • After deploy: request a code on the portal URL above and confirm it arrives.

Made with Cursor

codercatdev and others added 2 commits November 6, 2026 19:14
…mail Sending

656d9e6 stubbed out sendCodingCatEmail to stop automated outreach, which
also silently stopped sign-in codes and magic links: Better Auth ignored the
false return, so /portal/[token] and /sign-in reported "code sent" while
nothing was sent.

Sign-in emails now go through the EMAIL binding (Cloudflare Email Sending,
codingcat.dev is onboarded) from noreply@codingcat.dev and throw on failure,
so the UI shows an error instead of a phantom success. Outreach email stays
disabled.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

⚡ Cloudflare Worker Preview Ready!

Environment URL
PR Preview https://0bedbc64-codingcatdev-dev.codingcatdev.workers.dev
Dev Custom Domain https://dev.codingcat.dev
  • Worker Version ID: 0bedbc64-f253-4264-a24d-c8281d5d0916
  • Protection: Restricted to @codingcat.dev accounts via Cloudflare Zero Trust Access

@codercatdev
codercatdev merged commit 0adf1cf into dev Nov 7, 2026
2 checks passed
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