Skip to content

Commit

Permalink
Avoid panics on login (rancher#47106)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmatseykanets authored Sep 13, 2024
1 parent b6c27c2 commit 708faee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/auth/providers/publicapi/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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 {
Expand Down

0 comments on commit 708faee

Please sign in to comment.