Trim space from createuser input
This commit is contained in:
parent
3b778226c8
commit
772c54f6fe
4
pkg.go
4
pkg.go
@ -49,6 +49,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION = "v0.1.0"
|
const VERSION = "v0.1.0"
|
||||||
@ -239,12 +240,15 @@ func (service *Service) CreateUserPrompt() { // {{{
|
|||||||
|
|
||||||
fmt.Printf("Username: ")
|
fmt.Printf("Username: ")
|
||||||
username, _ = reader.ReadString('\n')
|
username, _ = reader.ReadString('\n')
|
||||||
|
username = strings.TrimSpace(username)
|
||||||
|
|
||||||
fmt.Printf("Name: ")
|
fmt.Printf("Name: ")
|
||||||
name, _ = reader.ReadString('\n')
|
name, _ = reader.ReadString('\n')
|
||||||
|
name = strings.TrimSpace(name)
|
||||||
|
|
||||||
fmt.Printf("Password: ")
|
fmt.Printf("Password: ")
|
||||||
password, _ = reader.ReadString('\n')
|
password, _ = reader.ReadString('\n')
|
||||||
|
password = strings.TrimSpace(password)
|
||||||
|
|
||||||
err = service.CreateUser(username, password, name)
|
err = service.CreateUser(username, password, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user