[PR #7282] feat(email-otp): include user data in OTP verification emails #15442

Open
opened 2026-04-13 10:02:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7282
Author: @Bekacru
Created: 1/12/2026
Status: 🔄 Open

Base: nextHead: fix/email-otp-user


📝 Commits (7)

  • 342a555 feat(email-otp): include user data in OTP verification emails
  • aa932a7 Update packages/better-auth/src/plugins/email-otp/routes.ts
  • f9fd060 chore: lint
  • f2020a0 Revert "chore: lint"
  • fba1638 Merge branch 'canary' into fix/email-otp-user
  • 303a25d chore: lint
  • 72c28f9 Merge branch 'canary' into fix/email-otp-user

📊 Changes

3 files changed (+45 additions, -20 deletions)

View changed files

📝 packages/better-auth/src/plugins/email-otp/index.ts (+15 -10)
📝 packages/better-auth/src/plugins/email-otp/routes.ts (+15 -5)
📝 packages/better-auth/src/plugins/email-otp/types.ts (+15 -5)

📄 Description

closes #3761


Summary by cubic

Adds user data to OTP emails for email verification and password reset so templates can personalize content and providers don’t need extra lookups. Addresses #3761 and updates the Email OTP plugin API and types.

  • New Features

    • Include user in sendVerificationOTP for email-verification and forget-password; sign-in remains unchanged.
    • Look up user by email before sending verification OTP; only send if a user exists.
    • Add SendVerificationOTPData union and update EmailOTPOptions.sendVerificationOTP signature.
  • Migration

    • Update your sendVerificationOTP handler to accept the new union payload and handle user for email-verification and forget-password.
    • No change needed for sign-in handling; it still receives email and otp only.

Written for commit fba1638cb1. 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/7282 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 1/12/2026 **Status:** 🔄 Open **Base:** `next` ← **Head:** `fix/email-otp-user` --- ### 📝 Commits (7) - [`342a555`](https://github.com/better-auth/better-auth/commit/342a55508fc3c8b2647a95066a2e5d7c0b5e46b9) feat(email-otp): include user data in OTP verification emails - [`aa932a7`](https://github.com/better-auth/better-auth/commit/aa932a7e4940ff5e1637bc15c986d410293a635f) Update packages/better-auth/src/plugins/email-otp/routes.ts - [`f9fd060`](https://github.com/better-auth/better-auth/commit/f9fd060fdea8777e41d6c5d6146c897d8cf608ca) chore: lint - [`f2020a0`](https://github.com/better-auth/better-auth/commit/f2020a0bd9118e56d6d4fe41ce3c4832297e429b) Revert "chore: lint" - [`fba1638`](https://github.com/better-auth/better-auth/commit/fba1638cb1ce38418f2a02c0737950ee32b43ffd) Merge branch 'canary' into fix/email-otp-user - [`303a25d`](https://github.com/better-auth/better-auth/commit/303a25d67682d496c98d3d09d9f0efab388fee1d) chore: lint - [`72c28f9`](https://github.com/better-auth/better-auth/commit/72c28f9ea592c6208f9d011c5c54519a52d1dd1a) Merge branch 'canary' into fix/email-otp-user ### 📊 Changes **3 files changed** (+45 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+15 -10) 📝 `packages/better-auth/src/plugins/email-otp/routes.ts` (+15 -5) 📝 `packages/better-auth/src/plugins/email-otp/types.ts` (+15 -5) </details> ### 📄 Description closes #3761 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds user data to OTP emails for email verification and password reset so templates can personalize content and providers don’t need extra lookups. Addresses #3761 and updates the Email OTP plugin API and types. - **New Features** - Include user in sendVerificationOTP for email-verification and forget-password; sign-in remains unchanged. - Look up user by email before sending verification OTP; only send if a user exists. - Add SendVerificationOTPData union and update EmailOTPOptions.sendVerificationOTP signature. - **Migration** - Update your sendVerificationOTP handler to accept the new union payload and handle user for email-verification and forget-password. - No change needed for sign-in handling; it still receives email and otp only. <sup>Written for commit fba1638cb1ce38418f2a02c0737950ee32b43ffd. 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-13 10:02:01 -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#15442