[PR #6322] [MERGED] fix(two-factor): remove incorrect blocking logic in OTP setup and verification #23493

Closed
opened 2026-04-15 21:45:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6322
Author: @isaacriehm
Created: 11/26/2025
Status: Merged
Merged: 11/26/2025
Merged by: @Bekacru

Base: canaryHead: fix/two-factor-otp-db-lookup


📝 Commits (1)

  • 3fe0e9b fix(two-factor): remove incorrect blocking logic in OTP setup/verification

📊 Changes

1 file changed (+0 additions, -5 deletions)

View changed files

📝 packages/better-auth/src/plugins/two-factor/otp/index.ts (+0 -5)

📄 Description

This patch removes the conditional logic that blocked OTP setup and verification when
twoFactorEnabled was false. That behavior prevented sendOTP from running during initial
enrollment, which in turn broke the OTP verification flow entirely.

The updated implementation aligns with the expected behavior: OTP can be issued during setup,
and verification proceeds normally without requiring a pre-existing two-factor record.

This change directly addresses the problem described in #3561 by reverting #3302.

All changes are isolated to the two-factor OTP plugin. Code is formatted and linted per
project guidelines, and the patch is based on the current canary branch.


Summary by cubic

Removed the check that blocked OTP issuance when twoFactorEnabled was false, restoring OTP setup and verification during initial 2FA enrollment. OTP codes now send and verify as expected, addressing #3561.

Written for commit 3fe0e9b5ae. Summary will update automatically 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/6322 **Author:** [@isaacriehm](https://github.com/isaacriehm) **Created:** 11/26/2025 **Status:** ✅ Merged **Merged:** 11/26/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/two-factor-otp-db-lookup` --- ### 📝 Commits (1) - [`3fe0e9b`](https://github.com/better-auth/better-auth/commit/3fe0e9b5ae6143307d27f69ed9269fe3f419a7fc) fix(two-factor): remove incorrect blocking logic in OTP setup/verification ### 📊 Changes **1 file changed** (+0 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/two-factor/otp/index.ts` (+0 -5) </details> ### 📄 Description This patch removes the conditional logic that blocked OTP setup and verification when `twoFactorEnabled` was false. That behavior prevented `sendOTP` from running during initial enrollment, which in turn broke the OTP verification flow entirely. The updated implementation aligns with the expected behavior: OTP can be issued during setup, and verification proceeds normally without requiring a pre-existing two-factor record. This change directly addresses the problem described in #3561 by reverting #3302. All changes are isolated to the two-factor OTP plugin. Code is formatted and linted per project guidelines, and the patch is based on the current `canary` branch. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Removed the check that blocked OTP issuance when twoFactorEnabled was false, restoring OTP setup and verification during initial 2FA enrollment. OTP codes now send and verify as expected, addressing #3561. <sup>Written for commit 3fe0e9b5ae6143307d27f69ed9269fe3f419a7fc. Summary will update automatically 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-15 21:45:47 -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#23493