-
Notifications
You must be signed in to change notification settings - Fork 24
Closed
Labels
- User -Enjoyable to Use our SoftwareEnjoyable to Use our SoftwareEnhancement / Feature RequestSomething NewSomething New
Milestone
Description
Relates to: torrust/torrust-index-gui#259
Usernames will only allow the following characters:
- Uppercase and lowercase letters (
A-Z,a-z) - Digits (
0-9) - The simple dash (
-) - The underscore (
_)
Additionally, we'll enforce a maximum length of 20 characters for the usernames.
We exclude emojis, blank spaces, non-valid UTF-8 characters, and non-ASCII characters
^[A-Za-z0-9-_]{1,20}$Explanation:
^asserts the start of the string.[A-Za-z0-9-]is a character class that matches uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), and the simple dash (-) or underscore (_).{1,20}quantifier makes sure that the preceding character class matches between 1 and 20 times, inclusive, which enforces your maximum length requirement.$asserts the end of the string.
This regular expression ensures that usernames consist only of the specified characters and do not exceed 20 characters in length. It effectively excludes emojis, blank spaces, non-valid UTF-8 characters, and non-ASCII characters, as they are not included in the specified character set.
The API endpoint /register for registration should return a Bad Request when the username does to match this regexp.
Metadata
Metadata
Assignees
Labels
- User -Enjoyable to Use our SoftwareEnjoyable to Use our SoftwareEnhancement / Feature RequestSomething NewSomething New