[PR #3907] [CLOSED] fix(email-otp): otp email should only be sent once #21977

Closed
opened 2026-04-15 20:43:49 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3907
Author: @frectonz
Created: 8/10/2025
Status: Closed

Base: canaryHead: fix/email-otp-should-only-be-sent-once


📝 Commits (3)

  • 7b61a81 fix(email-otp): otp email should only be sent once
  • c20fe87 fix(email-otp): await the test function
  • 68b6d82 fix(email-otp): remove sign up hook

📊 Changes

2 files changed (+59 additions, -42 deletions)

View changed files

📝 packages/better-auth/src/plugins/email-otp/email-otp.test.ts (+49 -0)
📝 packages/better-auth/src/plugins/email-otp/index.ts (+10 -42)

📄 Description

This PR addresses an issue that was raised in discord [message link].

The problem was that sendVerificationOnSignUp is enabled along with overrideDefaultEmailVerification being enabled. this creates two points in which the sendVerificationOTP function is called. This PR fixes the issue by checking if sendVerificationOnSignUp is enabled before overriding the email verification function on the emailAndPassword options.


Summary by cubic

Fixed an issue where users received two OTP emails on sign up when both sendVerificationOnSignUp and overrideDefaultEmailVerification were enabled.

  • Bug Fixes
  • Now only one OTP email is sent during sign up, matching expected behavior.

🔄 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/3907 **Author:** [@frectonz](https://github.com/frectonz) **Created:** 8/10/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/email-otp-should-only-be-sent-once` --- ### 📝 Commits (3) - [`7b61a81`](https://github.com/better-auth/better-auth/commit/7b61a814ffa45b166dd1af4352560b45e1088d13) fix(email-otp): otp email should only be sent once - [`c20fe87`](https://github.com/better-auth/better-auth/commit/c20fe87adbaa728429fd8cc95c392fcd1156480c) fix(email-otp): await the test function - [`68b6d82`](https://github.com/better-auth/better-auth/commit/68b6d82b707ae6608dede26a5fe5dba1b0e297bb) fix(email-otp): remove sign up hook ### 📊 Changes **2 files changed** (+59 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/email-otp/email-otp.test.ts` (+49 -0) 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+10 -42) </details> ### 📄 Description This PR addresses an issue that was raised in discord [[message link](https://discord.com/channels/1288403910284935179/1288403910284935182/1404022323983548489)]. The problem was that `sendVerificationOnSignUp` is enabled along with `overrideDefaultEmailVerification` being enabled. this creates two points in which the `sendVerificationOTP` function is called. This PR fixes the issue by checking if `sendVerificationOnSignUp` is enabled before overriding the email verification function on the `emailAndPassword` options. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixed an issue where users received two OTP emails on sign up when both `sendVerificationOnSignUp` and `overrideDefaultEmailVerification` were enabled. - **Bug Fixes** - Now only one OTP email is sent during sign up, matching expected behavior. <!-- 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-04-15 20:43:49 -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#21977