[PR #3719] [CLOSED] Add username validation for length and format in availability check #4971

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3719
Author: @emersonlaurentino
Created: 7/31/2025
Status: Closed

Base: mainHead: feat/validation-username-available


📝 Commits (7)

  • 76dc755 feat(username): add validation for username length and format in availability check
  • e19a301 Update packages/better-auth/src/plugins/username/index.ts
  • a6415f2 chore: update
  • 54b27d2 chore: remove unused code
  • fddeea4 Merge branch 'main' into feat/validation-username-available
  • 24e32d5 Merge branch 'main' into feat/validation-username-available
  • 5efb0d9 Merge branch 'main' into feat/validation-username-available

📊 Changes

2 files changed (+90 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/plugins/username/index.ts (+27 -1)
📝 packages/better-auth/src/plugins/username/username.test.ts (+63 -0)

📄 Description

Implement validation to ensure usernames meet specified length requirements and format criteria during availability checks.

This enhancement improves error handling for invalid usernames.


Summary by cubic

Added username length and format validation to the availability check, returning clear errors for invalid usernames.

  • Bug Fixes
    • Returns specific errors for usernames that are too short, too long, or have invalid characters.

🔄 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/3719 **Author:** [@emersonlaurentino](https://github.com/emersonlaurentino) **Created:** 7/31/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/validation-username-available` --- ### 📝 Commits (7) - [`76dc755`](https://github.com/better-auth/better-auth/commit/76dc755df93cae31bf57334ca29609a7e373404d) feat(username): add validation for username length and format in availability check - [`e19a301`](https://github.com/better-auth/better-auth/commit/e19a301a61de7927b9658cff378887747109931e) Update packages/better-auth/src/plugins/username/index.ts - [`a6415f2`](https://github.com/better-auth/better-auth/commit/a6415f26027658a6ede70c4b4eb4da8bc130651b) chore: update - [`54b27d2`](https://github.com/better-auth/better-auth/commit/54b27d264c183be9ce27294debb3fc6b8bbe59ba) chore: remove unused code - [`fddeea4`](https://github.com/better-auth/better-auth/commit/fddeea4a99200fe4fcdcb790513c99f622eaedf3) Merge branch 'main' into feat/validation-username-available - [`24e32d5`](https://github.com/better-auth/better-auth/commit/24e32d5ef6ecc9ac81be8af323f572c4cefa2ff2) Merge branch 'main' into feat/validation-username-available - [`5efb0d9`](https://github.com/better-auth/better-auth/commit/5efb0d9926eb238a46b5e6e48418e51f62cb3729) Merge branch 'main' into feat/validation-username-available ### 📊 Changes **2 files changed** (+90 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/username/index.ts` (+27 -1) 📝 `packages/better-auth/src/plugins/username/username.test.ts` (+63 -0) </details> ### 📄 Description Implement validation to ensure usernames meet specified length requirements and format criteria during availability checks. This enhancement improves error handling for invalid usernames. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Added username length and format validation to the availability check, returning clear errors for invalid usernames. - **Bug Fixes** - Returns specific errors for usernames that are too short, too long, or have invalid characters. <!-- 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:05:55 -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#4971