Skip to content

Commit dd33c2b

Browse files
authored
Check if token is empty (#2392)
* If token is empty, explicitly warn against it
1 parent c754874 commit dd33c2b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/cli/login.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ func checkTokenFormat(token string) error {
173173
}
174174

175175
func verifyToken(registryHost string, token string) (username string, err error) {
176+
if token == "" {
177+
return "", fmt.Errorf("Token is empty")
178+
}
179+
176180
resp, err := http.PostForm(addressWithScheme(registryHost)+"/cog/v1/verify-token", url.Values{
177181
"token": []string{token},
178182
})

0 commit comments

Comments
 (0)