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

Open
opened 2026-03-13 13:58:45 -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: 🔄 Open

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


📝 Commits (2)

  • a5d75c3 feat(email-otp): add resendStrategy option to reuse existing OTP
  • e4dd264 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:** 🔄 Open **Base:** `canary` ← **Head:** `2026-03-12/feat/email-otp-resend-strategy` --- ### 📝 Commits (2) - [`a5d75c3`](https://github.com/better-auth/better-auth/commit/a5d75c35653cb9a8e497908a7ac6a4701e997cd6) feat(email-otp): add resendStrategy option to reuse existing OTP - [`e4dd264`](https://github.com/better-auth/better-auth/commit/e4dd264c0d22afd384fdfb4fceb88ea35a63ce73) 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-03-13 13:58:45 -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#8062