File tree 2 files changed +0
-29
lines changed
2 files changed +0
-29
lines changed Original file line number Diff line number Diff line change @@ -117,8 +117,6 @@ func Exec(_ *cobra.Command) {
117
117
displayScoutQuickViewSuggestMsgOnBuild (commandArgs )
118
118
case "pull" :
119
119
displayScoutQuickViewSuggestMsgOnPull (commandArgs )
120
- case "login" :
121
- displayPATSuggestMsg (commandArgs )
122
120
default :
123
121
}
124
122
}
Original file line number Diff line number Diff line change 17
17
package mobycli
18
18
19
19
import (
20
- "fmt"
21
- "os"
22
20
"strings"
23
21
24
- "github.com/docker/cli/cli/config"
25
22
"github.com/docker/docker/registry"
26
23
"github.com/hashicorp/go-uuid"
27
24
)
28
25
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
-
35
26
var (
36
27
patPrefixes = []string {"dckrp_" , "dckr_pat_" }
37
28
)
38
29
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
-
57
30
func isUsingDefaultRegistry (cmdArgs []string ) bool {
58
31
for i := 1 ; i < len (cmdArgs ); i ++ {
59
32
if strings .HasPrefix (cmdArgs [i ], "-" ) {
You can’t perform that action at this time.
0 commit comments