[PR #7712] [MERGED] fix: skip sending email verification to already verified users without a session #7507

Closed
opened 2026-03-13 13:39:36 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7712
Author: @bytaesu
Created: 1/30/2026
Status: Merged
Merged: 1/30/2026
Merged by: @himself65

Base: canaryHead: 2026-01-31/fix/skip-verification-email


📝 Commits (2)

  • 4bce932 fix: skip sending email verification to already verified users without a session
  • 9847e2d refactor: use same block

📊 Changes

2 files changed (+43 additions, -2 deletions)

View changed files

📝 packages/better-auth/src/api/routes/email-verification.test.ts (+41 -0)
📝 packages/better-auth/src/api/routes/email-verification.ts (+2 -2)

📄 Description


Summary by cubic

Prevents sending verification emails when an unauthenticated request targets an already verified email. The endpoint now short-circuits and returns status: true to avoid user enumeration.

  • Bug Fixes
    • Updated sendVerificationEmail to early-return when there’s no session and the user is missing or already verified (no email sent).
    • Added a test to confirm third-party requests don’t trigger emails for verified users.

Written for commit 9847e2d1ee. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7712 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 1/30/2026 **Status:** ✅ Merged **Merged:** 1/30/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `2026-01-31/fix/skip-verification-email` --- ### 📝 Commits (2) - [`4bce932`](https://github.com/better-auth/better-auth/commit/4bce932ea71f78093ce9688f6b9c08114309fd31) fix: skip sending email verification to already verified users without a session - [`9847e2d`](https://github.com/better-auth/better-auth/commit/9847e2d1ee5dcebcef032960e4f0a5c9c2778d78) refactor: use same block ### 📊 Changes **2 files changed** (+43 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/email-verification.test.ts` (+41 -0) 📝 `packages/better-auth/src/api/routes/email-verification.ts` (+2 -2) </details> ### 📄 Description - Closes https://github.com/better-auth/better-auth/issues/7707 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Prevents sending verification emails when an unauthenticated request targets an already verified email. The endpoint now short-circuits and returns status: true to avoid user enumeration. - **Bug Fixes** - Updated sendVerificationEmail to early-return when there’s no session and the user is missing or already verified (no email sent). - Added a test to confirm third-party requests don’t trigger emails for verified users. <sup>Written for commit 9847e2d1ee5dcebcef032960e4f0a5c9c2778d78. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:39:36 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#7507