зеркало из https://github.com/docker/hub-tool.git
Merge pull request #137 from docker/fix-sudo-commands
Do not try to 2FA if the user is not logged-in
This commit is contained in:
Коммит
06a23b6d7b
|
@ -70,15 +70,15 @@ func NewRootCmd(streams command.Streams, hubClient *hub.Client, store credential
|
|||
return nil
|
||||
}
|
||||
|
||||
if cmd.Annotations["sudo"] == "true" {
|
||||
return requireTwoFactorCode(cmd.Context(), streams, hubClient, store)
|
||||
}
|
||||
|
||||
ac, err := store.GetAuth()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cmd.Annotations["sudo"] == "true" && ac.Username != "" {
|
||||
return requireTwoFactorCode(cmd.Context(), streams, hubClient, store)
|
||||
}
|
||||
|
||||
if ac.Username == "" {
|
||||
log.Fatal(ansi.Error(`You need to be logged in to Docker Hub to use this tool.
|
||||
Please login to Docker Hub using the "hub-tool login" command.`))
|
||||
|
|
Загрузка…
Ссылка в новой задаче