From 5c5918e54540ebb6de9f1f19fdfb4e4afdb184f6 Mon Sep 17 00:00:00 2001 From: Livio Amstutz Date: Mon, 29 Mar 2021 21:15:18 +0200 Subject: [PATCH] fix: improve login name display after user selection (#1493) --- .../repository/eventsourcing/eventstore/auth_request.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/auth/repository/eventsourcing/eventstore/auth_request.go b/internal/auth/repository/eventsourcing/eventstore/auth_request.go index 19e9e3e6ad..e879a1bde7 100644 --- a/internal/auth/repository/eventsourcing/eventstore/auth_request.go +++ b/internal/auth/repository/eventsourcing/eventstore/auth_request.go @@ -244,7 +244,11 @@ func (repo *AuthRequestRepo) SelectUser(ctx context.Context, id, userID, userAge if request.RequestedOrgID != "" && request.RequestedOrgID != user.ResourceOwner { return errors.ThrowPreconditionFailed(nil, "EVENT-fJe2a", "Errors.User.NotAllowedOrg") } - request.SetUserInfo(user.ID, user.UserName, user.PreferredLoginName, user.DisplayName, user.ResourceOwner) + username := user.UserName + if request.RequestedOrgID == "" { + username = user.PreferredLoginName + } + request.SetUserInfo(user.ID, username, user.PreferredLoginName, user.DisplayName, user.ResourceOwner) return repo.AuthRequests.UpdateAuthRequest(ctx, request) }