From 772c54f6fe8a7bf18dd5756778a3e9d00131b9aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Fri, 26 Jan 2024 08:00:51 +0100 Subject: [PATCH] Trim space from createuser input --- pkg.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg.go b/pkg.go index 7eecad7..e03e81e 100644 --- a/pkg.go +++ b/pkg.go @@ -49,6 +49,7 @@ import ( "net/http" "os" "regexp" + "strings" ) const VERSION = "v0.1.0" @@ -239,12 +240,15 @@ func (service *Service) CreateUserPrompt() { // {{{ fmt.Printf("Username: ") username, _ = reader.ReadString('\n') + username = strings.TrimSpace(username) fmt.Printf("Name: ") name, _ = reader.ReadString('\n') + name = strings.TrimSpace(name) fmt.Printf("Password: ") password, _ = reader.ReadString('\n') + password = strings.TrimSpace(password) err = service.CreateUser(username, password, name) if err != nil {