From 867082d3a5da720f9a43e71fb8018dd80483625c Mon Sep 17 00:00:00 2001 From: gagandeepp Date: Thu, 10 Oct 2024 13:41:24 +0530 Subject: [PATCH 1/5] Initial commit Signed-off-by: gagandeepp --- internal/action/setup.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/action/setup.go b/internal/action/setup.go index b3d55435b4..ca500cc1d4 100644 --- a/internal/action/setup.go +++ b/internal/action/setup.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "strings" "github.com/fatih/color" "github.com/gopasspw/gopass/internal/action/exit" @@ -137,6 +138,10 @@ func (s *Action) initGenerateIdentity(ctx context.Context, crypto backend.Crypto } email, err = termio.AskForString(ctx, "📧 What is your email?", email) + + if strings.TrimSpace(email) == "" { + return fmt.Errorf("failed to create a usable key pair") + } if err != nil { return err } From 9dff5f5129dafdadaf1c45b549d2876e1805953b Mon Sep 17 00:00:00 2001 From: gagandeepp Date: Fri, 11 Oct 2024 13:44:45 +0530 Subject: [PATCH 2/5] Initial commit Signed-off-by: gagandeepp --- internal/action/setup.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/action/setup.go b/internal/action/setup.go index ca500cc1d4..6f54e7b566 100644 --- a/internal/action/setup.go +++ b/internal/action/setup.go @@ -140,7 +140,7 @@ func (s *Action) initGenerateIdentity(ctx context.Context, crypto backend.Crypto email, err = termio.AskForString(ctx, "📧 What is your email?", email) if strings.TrimSpace(email) == "" { - return fmt.Errorf("failed to create a usable key pair") + return fmt.Errorf("Please enter a valid email address to proceed") } if err != nil { return err From 8070e0949ce902bb541506ba983363938db118cd Mon Sep 17 00:00:00 2001 From: gagandeepp Date: Fri, 11 Oct 2024 13:48:27 +0530 Subject: [PATCH 3/5] Error Message fixed Signed-off-by: gagandeepp --- internal/action/setup.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/action/setup.go b/internal/action/setup.go index 6f54e7b566..e43a9c90a6 100644 --- a/internal/action/setup.go +++ b/internal/action/setup.go @@ -140,7 +140,7 @@ func (s *Action) initGenerateIdentity(ctx context.Context, crypto backend.Crypto email, err = termio.AskForString(ctx, "📧 What is your email?", email) if strings.TrimSpace(email) == "" { - return fmt.Errorf("Please enter a valid email address to proceed") + return fmt.Errorf("⛔️ Please enter a valid email address to proceed") } if err != nil { return err From 96b4948009b2f9b8d69c0d54c4927dc1cf9c25c1 Mon Sep 17 00:00:00 2001 From: gagandeepp Date: Fri, 11 Oct 2024 17:02:59 +0530 Subject: [PATCH 4/5] Review pointer implemented Signed-off-by: gagandeepp --- internal/action/setup.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/action/setup.go b/internal/action/setup.go index e43a9c90a6..d019ea23d8 100644 --- a/internal/action/setup.go +++ b/internal/action/setup.go @@ -139,12 +139,13 @@ func (s *Action) initGenerateIdentity(ctx context.Context, crypto backend.Crypto email, err = termio.AskForString(ctx, "📧 What is your email?", email) - if strings.TrimSpace(email) == "" { - return fmt.Errorf("⛔️ Please enter a valid email address to proceed") - } + if err != nil { return err } + if strings.TrimSpace(email) == "" { + return fmt.Errorf("⛔️ Please enter a valid email address to proceed") + } } passphrase := xkcdgen.Random() From ed4df67712184f9dadbe4fa65436e684b2823722 Mon Sep 17 00:00:00 2001 From: gagandeepp Date: Fri, 11 Oct 2024 17:04:04 +0530 Subject: [PATCH 5/5] Extra lines removed Signed-off-by: gagandeepp --- internal/action/setup.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/internal/action/setup.go b/internal/action/setup.go index d019ea23d8..21ccffd207 100644 --- a/internal/action/setup.go +++ b/internal/action/setup.go @@ -138,8 +138,6 @@ func (s *Action) initGenerateIdentity(ctx context.Context, crypto backend.Crypto } email, err = termio.AskForString(ctx, "📧 What is your email?", email) - - if err != nil { return err }