[PR #8560] [MERGED] feat(email-otp): add resendStrategy option to reuse existing OTP #24962

Closed
opened 2026-04-15 22:39:25 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8560
Author: @bytaesu
Created: 3/12/2026
Status: Merged
Merged: 3/17/2026
Merged by: @himself65

Base: canaryHead: 2026-03-12/feat/email-otp-resend-strategy


📝 Commits (2)

  • 91f7d21 feat(email-otp): add resendStrategy option to reuse existing OTP
  • a3dad94 chore: add otps to auth-terms

📊 Changes

8 files changed (+411 additions, -95 deletions)

View changed files

📝 .cspell/auth-terms.txt (+1 -0)
📝 docs/content/docs/plugins/email-otp.mdx (+20 -0)
📝 packages/better-auth/src/plugins/email-otp/email-otp.test.ts (+224 -0)
📝 packages/better-auth/src/plugins/email-otp/index.ts (+2 -1)
📝 packages/better-auth/src/plugins/email-otp/otp-token.ts (+55 -2)
📝 packages/better-auth/src/plugins/email-otp/routes.ts (+82 -92)
📝 packages/better-auth/src/plugins/email-otp/types.ts (+19 -0)
📝 packages/better-auth/src/plugins/email-otp/utils.ts (+8 -0)

📄 Description

Note

When reusing an OTP, we preserve the existing attempt count rather than resetting it. This ensures that allowedAttempts cannot be bypassed by repeatedly requesting resends.


🔄 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/8560 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 3/12/2026 **Status:** ✅ Merged **Merged:** 3/17/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `2026-03-12/feat/email-otp-resend-strategy` --- ### 📝 Commits (2) - [`91f7d21`](https://github.com/better-auth/better-auth/commit/91f7d216c80f71c1e39c50dffc187e61af4a13d7) feat(email-otp): add resendStrategy option to reuse existing OTP - [`a3dad94`](https://github.com/better-auth/better-auth/commit/a3dad94ef10d9d2126f8c23ec89ec1737194b2fc) chore: add otps to auth-terms ### 📊 Changes **8 files changed** (+411 additions, -95 deletions) <details> <summary>View changed files</summary> 📝 `.cspell/auth-terms.txt` (+1 -0) 📝 `docs/content/docs/plugins/email-otp.mdx` (+20 -0) 📝 `packages/better-auth/src/plugins/email-otp/email-otp.test.ts` (+224 -0) 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+2 -1) 📝 `packages/better-auth/src/plugins/email-otp/otp-token.ts` (+55 -2) 📝 `packages/better-auth/src/plugins/email-otp/routes.ts` (+82 -92) 📝 `packages/better-auth/src/plugins/email-otp/types.ts` (+19 -0) 📝 `packages/better-auth/src/plugins/email-otp/utils.ts` (+8 -0) </details> ### 📄 Description - Closes #1568 > [!NOTE] > When reusing an OTP, we preserve the existing attempt count rather than resetting it. This ensures that `allowedAttempts` cannot be bypassed by repeatedly requesting resends. --- <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 22:39:25 -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#24962