Trim space from createuser input

This commit is contained in:
Magnus Åhall 2024-01-26 08:00:51 +01:00
parent 3b778226c8
commit 772c54f6fe

4
pkg.go
View File

@ -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 {