mirror of
https://github.com/juanfont/headscale.git
synced 2025-07-02 13:08:32 +00:00
Ensure that a username starts with a letter (#2635)
This commit is contained in:
parent
081af2674b
commit
e73b2a9fb9
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user