[PR #7121] [MERGED] fix(email-otp): call afterEmailVerification hook on verification #32689

Closed
opened 2026-04-17 23:26:38 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7121
Author: @GautamBytes
Created: 1/4/2026
Status: Merged
Merged: 1/5/2026
Merged by: @himself65

Base: canaryHead: fix/email-otp-hook


📝 Commits (1)

  • 84afbd9 fix(email-otp): call afterEmailVerification hook on verification

📊 Changes

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

View changed files

📝 packages/better-auth/src/plugins/email-otp/email-otp.test.ts (+51 -0)
📝 packages/better-auth/src/plugins/email-otp/routes.ts (+5 -0)

📄 Description

Description

This PR fixes issue #7117 where the afterEmailVerification hook was not being called when using the email-otp plugin with overrideDefaultEmailVerification: true.

Previously, only onEmailVerification was executed. This change adds the missing call to afterEmailVerification immediately after the user is verified, ensuring both hooks run as expected in the configuration.

Fixes

Fixes #7117


Summary by cubic

Calls afterEmailVerification during email-otp verification when overrideDefaultEmailVerification is true. Ensures both hooks run right after the user is verified.

  • Bug Fixes
    • Invoke afterEmailVerification with the updated user in verifyEmailOTP.
    • Add test to assert the hook fires once with the expected payload.

Fixes #7117

Written for commit 84afbd9480. Summary will update on new commits.


🔄 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/7121 **Author:** [@GautamBytes](https://github.com/GautamBytes) **Created:** 1/4/2026 **Status:** ✅ Merged **Merged:** 1/5/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/email-otp-hook` --- ### 📝 Commits (1) - [`84afbd9`](https://github.com/better-auth/better-auth/commit/84afbd9480a90f2e2268ae8d4d7e1b2412339c18) fix(email-otp): call afterEmailVerification hook on verification ### 📊 Changes **2 files changed** (+56 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/email-otp/email-otp.test.ts` (+51 -0) 📝 `packages/better-auth/src/plugins/email-otp/routes.ts` (+5 -0) </details> ### 📄 Description ## Description This PR fixes issue #7117 where the `afterEmailVerification` hook was not being called when using the `email-otp` plugin with `overrideDefaultEmailVerification: true`. Previously, only `onEmailVerification` was executed. This change adds the missing call to `afterEmailVerification` immediately after the user is verified, ensuring both hooks run as expected in the configuration. ## Fixes Fixes #7117 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Calls afterEmailVerification during email-otp verification when overrideDefaultEmailVerification is true. Ensures both hooks run right after the user is verified. - **Bug Fixes** - Invoke afterEmailVerification with the updated user in verifyEmailOTP. - Add test to assert the hook fires once with the expected payload. Fixes #7117 <sup>Written for commit 84afbd9480a90f2e2268ae8d4d7e1b2412339c18. Summary will update on new commits.</sup> <!-- 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 23:26:38 -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#32689