From 708faee1c64f70643de2e13955fa4d2d7a83a8a1 Mon Sep 17 00:00:00 2001 From: Peter Matseykanets Date: Fri, 13 Sep 2024 10:47:06 -0400 Subject: [PATCH] Avoid panics on login (#47106) --- pkg/auth/providers/publicapi/login.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/auth/providers/publicapi/login.go b/pkg/auth/providers/publicapi/login.go index 9a98831cef8..f874be61762 100644 --- a/pkg/auth/providers/publicapi/login.go +++ b/pkg/auth/providers/publicapi/login.go @@ -224,7 +224,7 @@ func (h *loginHandler) createLoginToken(request *types.APIContext) (v3.Token, st currUser, err = h.userMGR.EnsureUser(userPrincipal.Name, displayName) if err != nil { - logrus.Warnf("Error creating or updating user for %s, retrying: %v", currUser.Name, err) + logrus.Warnf("Error creating or updating user for %s, retrying: %v", userPrincipal.Name, err) return false, nil } @@ -237,14 +237,14 @@ func (h *loginHandler) createLoginToken(request *types.APIContext) (v3.Token, st userExtraInfo := providers.GetUserExtraAttributes(providerName, userPrincipal) err = h.tokenMGR.UserAttributeCreateOrUpdate(currUser.Name, userPrincipal.Provider, groupPrincipals, userExtraInfo, loginTime) if err != nil { - logrus.Warnf("Error creating or updating userAttribute for %s, retrying: %v", currUser.Name, err) + logrus.Warnf("Error creating or updating userAttribute for %s, retrying: %v", userPrincipal.Name, err) return false, nil } return true, nil }) if err != nil { - return v3.Token{}, "", "", fmt.Errorf("error creating or updating user and/or userAttribute for %s: %w", currUser.Name, err) + return v3.Token{}, "", "", fmt.Errorf("error creating or updating user and/or userAttribute for %s: %w", userPrincipal.Name, err) } if !enabled {