summaryrefslogtreecommitdiff
path: root/cmd/podman/login.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/login.go')
-rw-r--r--cmd/podman/login.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd/podman/login.go b/cmd/podman/login.go
index 76f0f50ff..aa26d1466 100644
--- a/cmd/podman/login.go
+++ b/cmd/podman/login.go
@@ -60,10 +60,7 @@ func loginCmd(c *cli.Context) error {
if len(args) == 0 {
return errors.Errorf("registry must be given")
}
- var server string
- if len(args) == 1 {
- server = args[0]
- }
+ server := scrubServer(args[0])
authfile := getAuthFile(c.String("authfile"))
sc := common.GetSystemContext("", authfile, false)
@@ -113,6 +110,10 @@ func getUserAndPass(username, password, userFromAuthFile string) (string, string
if err != nil {
return "", "", errors.Wrapf(err, "error reading username")
}
+ // If no username provided, use userFromAuthFile instead.
+ if strings.TrimSpace(username) == "" {
+ username = userFromAuthFile
+ }
}
if password == "" {
fmt.Print("Password: ")