From 2687502ba4e3d3eb41b6da6b52de151ef5dca9a2 Mon Sep 17 00:00:00 2001 From: Hu Keping Date: Tue, 10 Mar 2015 07:48:48 +0800 Subject: [PATCH] Remove leading spaces of username when login When we run `docker login` we will be asked to input our username. Prior to this PR, "userA" and " userA" will be considered as two diferrent user, which is not right. Signed-off-by: Hu Keping --- api/client/commands.go | 1 + 1 file changed, 1 insertion(+) diff --git a/api/client/commands.go b/api/client/commands.go index 0d11e358f5..6230613fc4 100644 --- a/api/client/commands.go +++ b/api/client/commands.go @@ -344,6 +344,7 @@ func (cli *DockerCli) CmdLogin(args ...string) error { if username == "" { promptDefault("Username", authconfig.Username) username = readInput(cli.in, cli.out) + username = strings.Trim(username, " ") if username == "" { username = authconfig.Username }