Ensure that a username starts with a letter (#2635)

This commit is contained in:
nblock 2025-06-24 14:45:44 +02:00 committed by GitHub
parent 081af2674b
commit e73b2a9fb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,9 +37,9 @@ func ValidateUsername(username string) error {
return errors.New("username must be at least 2 characters long")
}
// Ensure the username does not start with a number
if unicode.IsDigit(rune(username[0])) {
return errors.New("username cannot start with a number")
// Ensure the username starts with a letter
if !unicode.IsLetter(rune(username[0])) {
return errors.New("username must start with a letter")
}
atCount := 0