Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pkg/docker/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,19 @@ func GetAuthentication(sys *types.SystemContext, registry string) (string, strin
return "", "", nil
}

// GetUserLoggedIn returns the username logged in to registry from either
// GetUserLoggedIn returns the username and the password of user logged in to registry from either
// auth.json or XDG_RUNTIME_DIR
// Used to tell the user if someone is logged in to the registry when logging in
func GetUserLoggedIn(sys *types.SystemContext, registry string) (string, error) {
func GetUserLoggedIn(sys *types.SystemContext, registry string) (string, string, error) {
path, err := getPathToAuth(sys)
if err != nil {
return "", err
return "", "", err
}
username, _, _ := findAuthentication(registry, path, false)
username, password, _ := findAuthentication(registry, path, false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not ignore the error from findAuthentication(...).

if username != "" {
return username, nil
return username, password, nil
}
return "", nil
return "", "", nil
}

// RemoveAuthentication deletes the credentials stored in auth.json
Expand Down