[PR #6592] feat(username): add support for checking username availabitly in exte… #6766

Open
opened 2026-03-13 13:11:05 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6592
Author: @AVtheking
Created: 12/7/2025
Status: 🔄 Open

Base: canaryHead: feat/username-availabilty-checker


📝 Commits (3)

  • f422d96 feat(username): add support for checking username availabitly in external system
  • 5025427 Merge branch 'canary' into feat/username-availabilty-checker
  • c06cd8c Merge branch 'canary' into feat/username-availabilty-checker

📊 Changes

2 files changed (+67 additions, -0 deletions)

View changed files

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

📄 Description

Summary by cubic

Adds an optional usernameAvailabilityChecker to the username plugin to support external availability checks before the database lookup. This prevents externally reserved names from appearing as available in isUsernameAvailable.

  • New Features
    • Added usernameAvailabilityChecker option (sync or async). Return false to mark a username as unavailable.
    • Runs before the DB query and uses the existing normalizer.
    • isUsernameAvailable now respects external reservation logic.
    • Added tests covering reserved names like “admin” and non-reserved names.

Written for commit f422d96309. Summary will update automatically on new commits.


Fixes #6579


🔄 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/6592 **Author:** [@AVtheking](https://github.com/AVtheking) **Created:** 12/7/2025 **Status:** 🔄 Open **Base:** `canary` ← **Head:** `feat/username-availabilty-checker` --- ### 📝 Commits (3) - [`f422d96`](https://github.com/better-auth/better-auth/commit/f422d963090f557e439b97eff0afb9e4a1eaf64c) feat(username): add support for checking username availabitly in external system - [`5025427`](https://github.com/better-auth/better-auth/commit/5025427a37c31c119f9d5253321ece879a61a8af) Merge branch 'canary' into feat/username-availabilty-checker - [`c06cd8c`](https://github.com/better-auth/better-auth/commit/c06cd8ca71a4368d378c5d758f7b7561ea054f78) Merge branch 'canary' into feat/username-availabilty-checker ### 📊 Changes **2 files changed** (+67 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/username/index.ts` (+25 -0) 📝 `packages/better-auth/src/plugins/username/username.test.ts` (+42 -0) </details> ### 📄 Description ## Summary by cubic Adds an optional usernameAvailabilityChecker to the username plugin to support external availability checks before the database lookup. This prevents externally reserved names from appearing as available in isUsernameAvailable. - **New Features** - Added usernameAvailabilityChecker option (sync or async). Return false to mark a username as unavailable. - Runs before the DB query and uses the existing normalizer. - isUsernameAvailable now respects external reservation logic. - Added tests covering reserved names like “admin” and non-reserved names. <sup>Written for commit f422d963090f557e439b97eff0afb9e4a1eaf64c. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- Fixes #6579 --- <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 13:11:05 -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#6766