mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:37:32 +00:00
fix: preferred login name (#231)
* fix: add preferred login name to my user sessions and get user info from view * fix: my user in auth
This commit is contained in:
@@ -64,6 +64,10 @@ func (repo *UserRepo) Register(ctx context.Context, registerUser *model.User, or
|
||||
return usr_model.UserToModel(user), nil
|
||||
}
|
||||
|
||||
func (repo *UserRepo) MyUser(ctx context.Context) (*model.UserView, error) {
|
||||
return repo.UserByID(ctx, auth.GetCtxData(ctx).UserID)
|
||||
}
|
||||
|
||||
func (repo *UserRepo) MyProfile(ctx context.Context) (*model.Profile, error) {
|
||||
user, err := repo.UserByID(ctx, auth.GetCtxData(ctx).UserID)
|
||||
if err != nil {
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
req_model "github.com/caos/zitadel/internal/auth_request/model"
|
||||
@@ -99,7 +98,7 @@ func (u *UserSession) updateSession(session *view_model.UserSessionView, event *
|
||||
}
|
||||
|
||||
func (u *UserSession) fillUserInfo(session *view_model.UserSessionView, id string) error {
|
||||
user, err := u.userEvents.UserByID(context.Background(), id)
|
||||
user, err := u.view.UserByID(id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -29,6 +29,8 @@ type UserRepository interface {
|
||||
}
|
||||
|
||||
type myUserRepo interface {
|
||||
MyUser(ctx context.Context) (*model.UserView, error)
|
||||
|
||||
MyProfile(ctx context.Context) (*model.Profile, error)
|
||||
ChangeMyProfile(ctx context.Context, profile *model.Profile) (*model.Profile, error)
|
||||
|
||||
|
Reference in New Issue
Block a user