fix: set correct username / preferred login name after idp callback (#2189)

This commit is contained in:
Livio Amstutz 2021-08-16 07:05:56 +02:00 committed by GitHub
parent 1e2c1a4f04
commit 490d087d45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -592,7 +592,11 @@ func (repo *AuthRequestRepo) checkExternalUserLogin(ctx context.Context, request
if err != nil {
return err
}
request.SetUserInfo(user.ID, user.UserName, user.PreferredLoginName, user.DisplayName, user.AvatarKey, user.ResourceOwner)
username := user.UserName
if request.RequestedOrgID == "" {
username = user.PreferredLoginName
}
request.SetUserInfo(user.ID, username, user.PreferredLoginName, user.DisplayName, user.AvatarKey, user.ResourceOwner)
return nil
}