create-account cmd: user already exists error message

This commit is contained in:
Crom (Thibaut CHARLES) 2017-12-11 14:17:10 +01:00
parent afe51d07e8
commit 2ded148e0b
No known key found for this signature in database
GPG key ID: 45A3D5F880B9E6D0

View file

@ -69,10 +69,13 @@ func main() {
os.Exit(1)
}
_, err = accountDB.CreateAccount(context.Background(), *username, *password)
account, err := accountDB.CreateAccount(context.Background(), *username, *password)
if err != nil {
fmt.Println(err.Error())
os.Exit(1)
} else if account == nil {
fmt.Println("Username already exists")
os.Exit(1)
}
deviceDB, err := devices.NewDatabase(*database, serverName)