Skip to content

Commit

Permalink
Allow 2-50 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoferlund committed Aug 18, 2023
1 parent 5fd27b6 commit 2df4b3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/api/src/users/utils/is-valid-username.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* A valid username is:
* - is lowercase
* - minimum 3 characters
* - minimum 2 characters
* - maximum 50 characters
* - only alphanumeric characters, underscores, dots, and hyphens
* - cannot start with a dot or hyphen
* - cannot end with a dot or hyphen
* - cannot contain two dots, two hyphens, or two underscores in a row
*/
export function isValidUsername(username: string) {
const pattern = /^[a-z0-9][a-z0-9_.-]{2,48}[a-z0-9]$/;
const pattern = /^[a-z0-9][a-z0-9_.-]{0,48}[a-z0-9]$/;
return pattern.test(username);
}

0 comments on commit 2df4b3d

Please sign in to comment.