From 81247658266fff9fc31d45d86aa4e91867420757 Mon Sep 17 00:00:00 2001 From: timothyknight Date: Thu, 21 Jan 2016 16:03:27 -0500 Subject: [PATCH] handle multiple return values from gopass --- cli/hydra-host/handler/account.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cli/hydra-host/handler/account.go b/cli/hydra-host/handler/account.go index ea728383bbf..f4d30e97c66 100644 --- a/cli/hydra-host/handler/account.go +++ b/cli/hydra-host/handler/account.go @@ -14,14 +14,24 @@ type Account struct { func getPassword() (password string) { fmt.Println("Password: ") - password = string(gopass.GetPasswd()) - if password == "" { + pwd, err := gopass.GetPasswd() + if err != nil { + fmt.Errorf("Error: %s", err) + return getPassword() + } + password = string(pwd); + if string(pwd) == "" { fmt.Println("You did not provide a password. Please try again.") return getPassword() } fmt.Println("Confirm password: ") - if password != string(gopass.GetPasswd()) { + confirm, err := gopass.GetPasswd() + if err != nil { + fmt.Errorf("Error: %s", err) + return getPassword() + } + if password != string(confirm) { fmt.Println("Password and confirmation do not match. Please try again.") return getPassword() }