Skip to content

Commit 581cf36

Browse files
committed
cli/command: PromptUserForCredentials: move "post" check for empty name
move the "post" check for username being empty inside the branch that's handling the username, as it's the only branch where username is mutated after checking if it's empty. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent a55cfe5 commit 581cf36

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

cli/command/registry.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,11 @@ func PromptUserForCredentials(ctx context.Context, cli Cli, argUser, argPassword
150150
if argUser == "" {
151151
argUser = defaultUsername
152152
}
153+
if argUser == "" {
154+
return registrytypes.AuthConfig{}, errors.Errorf("Error: Non-null Username Required")
155+
}
153156
}
154-
if argUser == "" {
155-
return registrytypes.AuthConfig{}, errors.Errorf("Error: Non-null Username Required")
156-
}
157+
157158
if argPassword == "" {
158159
restoreInput, err := DisableInputEcho(cli.In())
159160
if err != nil {

0 commit comments

Comments
 (0)