Skip to content

Commit d22f3a8

Browse files
authored
login: Remove the PAT message, it's in docker/cli now (docker-archive#2261)
Signed-off-by: Djordje Lukic <[email protected]>
1 parent 118cd6d commit d22f3a8

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

cli/mobycli/exec.go

-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ func Exec(_ *cobra.Command) {
117117
displayScoutQuickViewSuggestMsgOnBuild(commandArgs)
118118
case "pull":
119119
displayScoutQuickViewSuggestMsgOnPull(commandArgs)
120-
case "login":
121-
displayPATSuggestMsg(commandArgs)
122120
default:
123121
}
124122
}

cli/mobycli/pat_suggest.go

-27
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,16 @@
1717
package mobycli
1818

1919
import (
20-
"fmt"
21-
"os"
2220
"strings"
2321

24-
"github.com/docker/cli/cli/config"
2522
"github.com/docker/docker/registry"
2623
"github.com/hashicorp/go-uuid"
2724
)
2825

29-
const (
30-
// patSuggestMsg is a message to suggest the use of PAT (personal access tokens).
31-
patSuggestMsg = `Logging in with your password grants your terminal complete access to your account.
32-
For better security, log in with a limited-privilege personal access token. Learn more at https://docs.docker.com/go/access-tokens/`
33-
)
34-
3526
var (
3627
patPrefixes = []string{"dckrp_", "dckr_pat_"}
3728
)
3829

39-
// displayPATSuggestMsg displays a message suggesting users to use PATs instead of passwords to reduce scope.
40-
func displayPATSuggestMsg(cmdArgs []string) {
41-
if os.Getenv("DOCKER_PAT_SUGGEST") == "false" {
42-
return
43-
}
44-
if !isUsingDefaultRegistry(cmdArgs) {
45-
return
46-
}
47-
authCfg, err := config.LoadDefaultConfigFile(os.Stderr).GetAuthConfig(registry.IndexServer)
48-
if err != nil {
49-
return
50-
}
51-
if !isUsingPassword(authCfg.Password) {
52-
return
53-
}
54-
fmt.Fprintf(os.Stderr, "\n"+patSuggestMsg+"\n")
55-
}
56-
5730
func isUsingDefaultRegistry(cmdArgs []string) bool {
5831
for i := 1; i < len(cmdArgs); i++ {
5932
if strings.HasPrefix(cmdArgs[i], "-") {

0 commit comments

Comments
 (0)