2023-08-02 16:57:53 +00:00
|
|
|
package user
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/internal/api/grpc/object/v2"
|
2024-07-26 20:39:55 +00:00
|
|
|
"github.com/zitadel/zitadel/pkg/grpc/user/v2"
|
2023-08-02 16:57:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (s *Server) AddOTPSMS(ctx context.Context, req *user.AddOTPSMSRequest) (*user.AddOTPSMSResponse, error) {
|
2024-03-27 18:22:17 +00:00
|
|
|
details, err := s.command.AddHumanOTPSMS(ctx, req.GetUserId(), "")
|
2023-08-02 16:57:53 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &user.AddOTPSMSResponse{Details: object.DomainToDetailsPb(details)}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) RemoveOTPSMS(ctx context.Context, req *user.RemoveOTPSMSRequest) (*user.RemoveOTPSMSResponse, error) {
|
2024-03-27 18:22:17 +00:00
|
|
|
objectDetails, err := s.command.RemoveHumanOTPSMS(ctx, req.GetUserId(), "")
|
2023-08-02 16:57:53 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &user.RemoveOTPSMSResponse{Details: object.DomainToDetailsPb(objectDetails)}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) AddOTPEmail(ctx context.Context, req *user.AddOTPEmailRequest) (*user.AddOTPEmailResponse, error) {
|
2024-03-27 18:22:17 +00:00
|
|
|
details, err := s.command.AddHumanOTPEmail(ctx, req.GetUserId(), "")
|
2023-08-02 16:57:53 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &user.AddOTPEmailResponse{Details: object.DomainToDetailsPb(details)}, nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) RemoveOTPEmail(ctx context.Context, req *user.RemoveOTPEmailRequest) (*user.RemoveOTPEmailResponse, error) {
|
2024-03-27 18:22:17 +00:00
|
|
|
objectDetails, err := s.command.RemoveHumanOTPEmail(ctx, req.GetUserId(), "")
|
2023-08-02 16:57:53 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &user.RemoveOTPEmailResponse{Details: object.DomainToDetailsPb(objectDetails)}, nil
|
|
|
|
}
|