From 0b6eb07e2dff8e49f8fd9de63924be2424589ffa Mon Sep 17 00:00:00 2001 From: Fabi <38692350+fgerschwiler@users.noreply.github.com> Date: Mon, 25 Apr 2022 16:30:25 +0200 Subject: [PATCH] fix: nil pointer on add user (missing phone) (#3487) --- internal/api/grpc/management/user.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/api/grpc/management/user.go b/internal/api/grpc/management/user.go index 78671590ca..0b5fb92b49 100644 --- a/internal/api/grpc/management/user.go +++ b/internal/api/grpc/management/user.go @@ -199,7 +199,7 @@ func (s *Server) AddHumanUser(ctx context.Context, req *mgmt_pb.AddHumanUserRequ lang, err := language.Parse(req.Profile.PreferredLanguage) logging.OnError(err).Debug("unable to parse language") - details, err := s.command.AddHuman(ctx, authz.GetCtxData(ctx).OrgID, &command.AddHuman{ + human := &command.AddHuman{ Username: req.UserName, FirstName: req.Profile.FirstName, LastName: req.Profile.LastName, @@ -220,7 +220,14 @@ func (s *Server) AddHumanUser(ctx context.Context, req *mgmt_pb.AddHumanUserRequ Passwordless: false, Register: false, ExternalIDP: false, - }) + } + if req.Phone != nil { + human.Phone = command.Phone{ + Number: req.Phone.Phone, + Verified: req.Phone.IsPhoneVerified, + } + } + details, err := s.command.AddHuman(ctx, authz.GetCtxData(ctx).OrgID, human) if err != nil { return nil, err }