diff --git a/internal/auth/repository/eventsourcing/eventstore/auth_request.go b/internal/auth/repository/eventsourcing/eventstore/auth_request.go index 8cecf0113..da3c3221a 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) } diff --git a/internal/repository/user/human.go b/internal/repository/user/human.go index efc18eca0..67ca9a107 100644 --- a/internal/repository/user/human.go +++ b/internal/repository/user/human.go @@ -372,7 +372,7 @@ type HumanSignedOutEvent struct { } func (e *HumanSignedOutEvent) Data() interface{} { - return nil + return e } func (e *HumanSignedOutEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint { diff --git a/internal/ui/login/static/templates/init_password.html b/internal/ui/login/static/templates/init_password.html index 846318088..c3987493b 100644 --- a/internal/ui/login/static/templates/init_password.html +++ b/internal/ui/login/static/templates/init_password.html @@ -36,15 +36,17 @@ {{ template "error-message" .}} - -