From 7e14d4b4e56fb212ef0cba9e8ac53bc429b31df4 Mon Sep 17 00:00:00 2001 From: Florian Preinstorfer Date: Thu, 29 May 2025 14:57:21 +0200 Subject: [PATCH] Ensure that a username starts with a letter The docstring for ValidateUsername() states: It must be at least 2 characters long, start with a letter, and contain only letters, numbers, hyphens, dots, and underscores. --- hscontrol/util/dns.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hscontrol/util/dns.go b/hscontrol/util/dns.go index f2938a8c..3a08fc3a 100644 --- a/hscontrol/util/dns.go +++ b/hscontrol/util/dns.go @@ -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