[PR #8443] [MERGED] fix(two-factor): wire twoFactorTable option to schema modelName #24878

Closed
opened 2026-04-15 22:36:29 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8443
Author: @himself65
Created: 3/6/2026
Status: Merged
Merged: 3/6/2026
Merged by: @himself65

Base: canaryHead: fix/two-factor-table-option


📝 Commits (1)

  • 59518ba fix(two-factor): wire twoFactorTable option to schema modelName

📊 Changes

3 files changed (+55 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/plugins/two-factor/index.ts (+9 -1)
📝 packages/better-auth/src/plugins/two-factor/two-factor.test.ts (+39 -0)
📝 packages/better-auth/src/plugins/two-factor/types.ts (+7 -0)

📄 Description

Summary

  • The twoFactorTable option in the two-factor plugin was documented but never actually wired up — it was always hardcoded to "twoFactor"
  • Now twoFactorTable correctly sets the schema modelName, so the adapter maps queries to the user-specified table name
  • Added twoFactorTable property to the TwoFactorOptions type

Closes #8424

Test plan

  • Added regression test that configures twoFactorTable: "custom_two_factor" and verifies enable/query works
  • Existing two-factor tests still pass
  • Typecheck passes
  • Lint passes

🔄 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/8443 **Author:** [@himself65](https://github.com/himself65) **Created:** 3/6/2026 **Status:** ✅ Merged **Merged:** 3/6/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/two-factor-table-option` --- ### 📝 Commits (1) - [`59518ba`](https://github.com/better-auth/better-auth/commit/59518bad376b87c88db348d64765e0e276ea4c77) fix(two-factor): wire twoFactorTable option to schema modelName ### 📊 Changes **3 files changed** (+55 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/two-factor/index.ts` (+9 -1) 📝 `packages/better-auth/src/plugins/two-factor/two-factor.test.ts` (+39 -0) 📝 `packages/better-auth/src/plugins/two-factor/types.ts` (+7 -0) </details> ### 📄 Description ## Summary - The `twoFactorTable` option in the two-factor plugin was documented but never actually wired up — it was always hardcoded to `"twoFactor"` - Now `twoFactorTable` correctly sets the schema `modelName`, so the adapter maps queries to the user-specified table name - Added `twoFactorTable` property to the `TwoFactorOptions` type Closes #8424 ## Test plan - [x] Added regression test that configures `twoFactorTable: "custom_two_factor"` and verifies enable/query works - [x] Existing two-factor tests still pass - [x] Typecheck passes - [x] Lint passes --- <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 22:36:29 -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#24878