[PR #4818] [MERGED] fix(email-otp): call reset password callback #31194

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4818
Author: @HoshangDEV
Created: 9/22/2025
Status: Merged
Merged: 9/25/2025
Merged by: @himself65

Base: canaryHead: refactor/email-otp-reset-password


📝 Commits (5)

  • 119dfd2 feat: add onPasswordReset callback for resetting password using email OTP flow
  • b68a194 refactor(email-otp): clean up formatting in onPasswordReset callback
  • 2f9714d Merge branch 'better-auth:canary' into refactor/email-otp-reset-password
  • 656be69 test(email-otp): add unit test for onPasswordReset callback during password reset flow
  • cc4041b Merge branch 'canary' into refactor/email-otp-reset-password

📊 Changes

2 files changed (+52 additions, -0 deletions)

View changed files

📝 packages/better-auth/src/plugins/email-otp/email-otp.test.ts (+43 -0)
📝 packages/better-auth/src/plugins/email-otp/index.ts (+9 -0)

📄 Description

  • Enhanced resetPasswordEmailOTP endpoint in packages/better-auth/src/plugins/email-otp/index.ts:1124-1131
  • Added callback invocation after successful password reset and before response

Summary by cubic

Added an onPasswordReset callback to the email OTP password reset flow so apps can run custom logic after a successful reset. The callback runs before the API responds.

  • New Features
    • Calls options.emailAndPassword.onPasswordReset({ user }, request).
    • Enables logging, notifications, or session cleanup post-reset.

🔄 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/4818 **Author:** [@HoshangDEV](https://github.com/HoshangDEV) **Created:** 9/22/2025 **Status:** ✅ Merged **Merged:** 9/25/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `refactor/email-otp-reset-password` --- ### 📝 Commits (5) - [`119dfd2`](https://github.com/better-auth/better-auth/commit/119dfd23b39ca8be05b121b150995bb049bfd05c) feat: add onPasswordReset callback for resetting password using email OTP flow - [`b68a194`](https://github.com/better-auth/better-auth/commit/b68a194aafde2a6a6297fe3b5e7bd96278fea0c1) refactor(email-otp): clean up formatting in onPasswordReset callback - [`2f9714d`](https://github.com/better-auth/better-auth/commit/2f9714d6a870dc504f3a3ff71f7fb0776e5f66d6) Merge branch 'better-auth:canary' into refactor/email-otp-reset-password - [`656be69`](https://github.com/better-auth/better-auth/commit/656be691725c43d3d37f830c6df980e24e8e399c) test(email-otp): add unit test for onPasswordReset callback during password reset flow - [`cc4041b`](https://github.com/better-auth/better-auth/commit/cc4041bd62f6e69e6c839bb22d918c6fecdfda38) Merge branch 'canary' into refactor/email-otp-reset-password ### 📊 Changes **2 files changed** (+52 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/email-otp/email-otp.test.ts` (+43 -0) 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+9 -0) </details> ### 📄 Description - Enhanced resetPasswordEmailOTP endpoint in packages/better-auth/src/plugins/email-otp/index.ts:1124-1131 - Added callback invocation after successful password reset and before response <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Added an onPasswordReset callback to the email OTP password reset flow so apps can run custom logic after a successful reset. The callback runs before the API responds. - **New Features** - Calls options.emailAndPassword.onPasswordReset({ user }, request). - Enables logging, notifications, or session cleanup post-reset. <!-- 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:06:21 -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#31194