fix: backend fixes (#1452)

* fix: email change not possible if init state

* fix: email change not possible if init state

* passwordless

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2021-03-22 15:36:59 +01:00
committed by GitHub
parent bd1a3bb6d7
commit c970003c82
4 changed files with 60 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/caos/zitadel/internal/api/grpc/object"
user_grpc "github.com/caos/zitadel/internal/api/grpc/user"
auth_pb "github.com/caos/zitadel/pkg/grpc/auth"
user_pb "github.com/caos/zitadel/pkg/grpc/user"
)
func (s *Server) ListMyPasswordless(ctx context.Context, _ *auth_pb.ListMyPasswordlessRequest) (*auth_pb.ListMyPasswordlessResponse, error) {
@@ -21,16 +22,18 @@ func (s *Server) ListMyPasswordless(ctx context.Context, _ *auth_pb.ListMyPasswo
func (s *Server) AddMyPasswordless(ctx context.Context, _ *auth_pb.AddMyPasswordlessRequest) (*auth_pb.AddMyPasswordlessResponse, error) {
ctxData := authz.GetCtxData(ctx)
u2f, err := s.command.HumanAddPasswordlessSetup(ctx, ctxData.UserID, ctxData.ResourceOwner, false)
token, err := s.command.HumanAddPasswordlessSetup(ctx, ctxData.UserID, ctxData.ResourceOwner, false)
if err != nil {
return nil, err
}
return &auth_pb.AddMyPasswordlessResponse{
Key: user_grpc.WebAuthNTokenToWebAuthNKeyPb(u2f),
Key: &user_pb.WebAuthNKey{
PublicKey: token.CredentialCreationData,
},
Details: object.AddToDetailsPb(
u2f.Sequence,
u2f.ChangeDate,
u2f.ResourceOwner,
token.Sequence,
token.ChangeDate,
token.ResourceOwner,
),
}, nil
}