[PR #8902] [MERGED] fix: use INVALID_PASSWORD for all checkPassword failures #16534

Closed
opened 2026-04-13 10:33:48 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8902
Author: @ping-maxwell
Created: 4/1/2026
Status: Merged
Merged: 4/7/2026
Merged by: @gustavovalverde

Base: mainHead: fix/use-consistent-error-for-checkPassword-failures


📝 Commits (3)

  • b1e380c fix: use INVALID_PASSWORD for all checkPassword failures
  • 3d68cd8 Merge branch 'main' into fix/use-consistent-error-for-checkPassword-failures
  • 173ba41 chore: changeset

📊 Changes

3 files changed (+85 additions, -6 deletions)

View changed files

.changeset/pr-8902.md (+5 -0)
📝 packages/better-auth/src/plugins/two-factor/two-factor.test.ts (+72 -0)
📝 packages/better-auth/src/utils/password.ts (+8 -6)

📄 Description

Closes https://github.com/better-auth/better-auth/issues/8900

checkPassword previously threw CREDENTIAL_ACCOUNT_NOT_FOUND when no credential account or stored password existed, and INVALID_PASSWORD only when verification failed. Callers (e.g. 2FA flows such as getTOTPURI when password is required) could distinguish OAuth-only or passwordless setups from wrong passwords via the error code.


🔄 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/8902 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 4/1/2026 **Status:** ✅ Merged **Merged:** 4/7/2026 **Merged by:** [@gustavovalverde](https://github.com/gustavovalverde) **Base:** `main` ← **Head:** `fix/use-consistent-error-for-checkPassword-failures` --- ### 📝 Commits (3) - [`b1e380c`](https://github.com/better-auth/better-auth/commit/b1e380c8f1586174678fd87f886e87a49a78c2d5) fix: use `INVALID_PASSWORD` for all `checkPassword` failures - [`3d68cd8`](https://github.com/better-auth/better-auth/commit/3d68cd85237876a04aea167a864a8df081e7d70a) Merge branch 'main' into fix/use-consistent-error-for-checkPassword-failures - [`173ba41`](https://github.com/better-auth/better-auth/commit/173ba415b35ef58e8886f4ed126f41fad245f15e) chore: changeset ### 📊 Changes **3 files changed** (+85 additions, -6 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/pr-8902.md` (+5 -0) 📝 `packages/better-auth/src/plugins/two-factor/two-factor.test.ts` (+72 -0) 📝 `packages/better-auth/src/utils/password.ts` (+8 -6) </details> ### 📄 Description Closes https://github.com/better-auth/better-auth/issues/8900 `checkPassword` previously threw `CREDENTIAL_ACCOUNT_NOT_FOUND` when no credential account or stored password existed, and `INVALID_PASSWORD` only when verification failed. Callers (e.g. 2FA flows such as `getTOTPURI` when password is required) could distinguish OAuth-only or passwordless setups from wrong passwords via the error code. --- <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:33:49 -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#16534