2021-04-16 12:55:55 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2022-01-03 08:19:07 +00:00
|
|
|
|
2021-04-16 12:55:55 +00:00
|
|
|
"github.com/caos/logging"
|
|
|
|
"github.com/caos/zitadel/internal/domain"
|
|
|
|
"github.com/caos/zitadel/internal/eventstore"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Step13 struct {
|
|
|
|
DefaultMailTemplate domain.MailTemplate
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Step13) Step() domain.Step {
|
|
|
|
return domain.Step13
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Step13) execute(ctx context.Context, commandSide *Commands) error {
|
|
|
|
return commandSide.SetupStep13(ctx, s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Commands) SetupStep13(ctx context.Context, step *Step13) error {
|
2022-01-03 08:19:07 +00:00
|
|
|
fn := func(iam *IAMWriteModel) ([]eventstore.Command, error) {
|
2021-04-16 12:55:55 +00:00
|
|
|
_, mailTemplateEvent, err := c.changeDefaultMailTemplate(ctx, &step.DefaultMailTemplate)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
logging.Log("SETUP-4insR").Info("default mail template/text set up")
|
2022-01-03 08:19:07 +00:00
|
|
|
return []eventstore.Command{mailTemplateEvent}, nil
|
2021-04-16 12:55:55 +00:00
|
|
|
}
|
|
|
|
return c.setup(ctx, step, fn)
|
|
|
|
}
|