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 <hukeping@huawei.com>
This commit is contained in:
Hu Keping 2015-03-10 07:48:48 +08:00
parent 93e78ac8e7
commit 2687502ba4
1 changed files with 1 additions and 0 deletions

View File

@ -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
}