[PR #4599] [MERGED] fix(username): sign in should work with post normalization #5473

Closed
opened 2026-03-13 12:24:06 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4599
Author: @Bekacru
Created: 9/12/2025
Status: Merged
Merged: 9/12/2025
Merged by: @himself65

Base: canaryHead: fix/username-normalization


📝 Commits (2)

  • be3f701 fix(username): sign in should work with pre normalization
  • 8101834 Merge branch 'canary' into fix/username-normalization

📊 Changes

2 files changed (+28 additions, -2 deletions)

View changed files

📝 packages/better-auth/src/plugins/username/index.ts (+3 -2)
📝 packages/better-auth/src/plugins/username/username.test.ts (+25 -0)

📄 Description

Summary by cubic

Fixes sign-in when usernames are normalized. We now look up users using the normalized value and return displayUsername to preserve original casing.

  • Bug Fixes
    • Use normalizer(username) when querying users during sign-in.
    • Include displayUsername in the returned user/session data.
    • Added a test to verify sign-in with normalized usernames.

🔄 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/4599 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 9/12/2025 **Status:** ✅ Merged **Merged:** 9/12/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/username-normalization` --- ### 📝 Commits (2) - [`be3f701`](https://github.com/better-auth/better-auth/commit/be3f701c8b7b8660c621aad825a8f52275cf96ad) fix(username): sign in should work with pre normalization - [`8101834`](https://github.com/better-auth/better-auth/commit/81018342142dbe521832edd8e69d7557cb2e31d8) Merge branch 'canary' into fix/username-normalization ### 📊 Changes **2 files changed** (+28 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/username/index.ts` (+3 -2) 📝 `packages/better-auth/src/plugins/username/username.test.ts` (+25 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Fixes sign-in when usernames are normalized. We now look up users using the normalized value and return displayUsername to preserve original casing. - **Bug Fixes** - Use normalizer(username) when querying users during sign-in. - Include displayUsername in the returned user/session data. - Added a test to verify sign-in with normalized usernames. <!-- 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-03-13 12:24:06 -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#5473