[PR #5255] [CLOSED] refactor(email-otp): deprecate forget-password in favor of request-password-reset #31483

Closed
opened 2026-04-17 22:22:18 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5255
Author: @ahmed-m-abbass
Created: 10/12/2025
Status: Closed

Base: canaryHead: email-otp/deprecate-forget-password-improve-verification-and-redirect


📝 Commits (5)

  • f76111e refactor(email-otp): deprecate forget password in favor of request password reset
  • cf7b6e9 docs(email-otp): update references from deprecated "forget password" to "request password reset"
  • ea66972 test(email-otp): add tests for request-password-reset and update types
  • ba161bc refactor(email-otp): use zod for email validation instead of manual regex
  • f5127b5 fix(email-otp): avoid multiple db queries for reset password endpoint

📊 Changes

3 files changed (+154 additions, -40 deletions)

View changed files

📝 docs/content/docs/plugins/email-otp.mdx (+9 -9)
📝 packages/better-auth/src/plugins/email-otp/email-otp.test.ts (+30 -7)
📝 packages/better-auth/src/plugins/email-otp/index.ts (+115 -24)

📄 Description


Summary by cubic

Replaced the “forget-password” flow with “request-password-reset” in the email OTP plugin. Adds a new endpoint and keeps legacy behavior working while improving verification lookup.

  • Refactors

    • Added POST /request-password-reset/email-otp with auth.api.requestPasswordResetEmailOTP and authClient.requestPasswordReset.emailOtp.
    • Deprecated forget-password endpoint and type; legacy endpoint retained with warnings.
    • Unified OTP type handling via EmailOTPType; verification checks both new and legacy identifiers.
  • Migration

    • Switch OTP type to "request-password-reset".
    • Use auth.api.requestPasswordResetEmailOTP and authClient.requestPasswordReset.emailOtp.
    • Existing forget-password calls still work for now but will be removed in the next major.

🔄 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/5255 **Author:** [@ahmed-m-abbass](https://github.com/ahmed-m-abbass) **Created:** 10/12/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `email-otp/deprecate-forget-password-improve-verification-and-redirect` --- ### 📝 Commits (5) - [`f76111e`](https://github.com/better-auth/better-auth/commit/f76111ea3b258b61ce697044967ebc3684b94c09) refactor(email-otp): deprecate forget password in favor of request password reset - [`cf7b6e9`](https://github.com/better-auth/better-auth/commit/cf7b6e98fdf8dc914a7d4dfc0c089444f20db5cb) docs(email-otp): update references from deprecated "forget password" to "request password reset" - [`ea66972`](https://github.com/better-auth/better-auth/commit/ea669726f306a641c82ae9629725417cba83c33d) test(email-otp): add tests for request-password-reset and update types - [`ba161bc`](https://github.com/better-auth/better-auth/commit/ba161bc3f1d2b34a1d8fcb2a0a4099dc3fa80c03) refactor(email-otp): use zod for email validation instead of manual regex - [`f5127b5`](https://github.com/better-auth/better-auth/commit/f5127b546f0d7a9f2365fe93a61cff283b559e8f) fix(email-otp): avoid multiple db queries for reset password endpoint ### 📊 Changes **3 files changed** (+154 additions, -40 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/email-otp.mdx` (+9 -9) 📝 `packages/better-auth/src/plugins/email-otp/email-otp.test.ts` (+30 -7) 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+115 -24) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Replaced the “forget-password” flow with “request-password-reset” in the email OTP plugin. Adds a new endpoint and keeps legacy behavior working while improving verification lookup. - **Refactors** - Added POST `/request-password-reset/email-otp` with `auth.api.requestPasswordResetEmailOTP` and `authClient.requestPasswordReset.emailOtp`. - Deprecated `forget-password` endpoint and type; legacy endpoint retained with warnings. - Unified OTP type handling via `EmailOTPType`; verification checks both new and legacy identifiers. - **Migration** - Switch OTP type to `"request-password-reset"`. - Use `auth.api.requestPasswordResetEmailOTP` and `authClient.requestPasswordReset.emailOtp`. - Existing `forget-password` calls still work for now but will be removed in the next major. <!-- 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-17 22:22:18 -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#31483