mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-18 05:47:32 +00:00
bc951985ed
* feat: lock users if lockout policy is set * feat: setup * feat: lock user on password failes * feat: render error * feat: lock user on command side * feat: auth_req tests * feat: lockout policy docs * feat: remove show lockout failures from proto * fix: console lockout * feat: tests * fix: tests * unlock function * add unlock button * fix migration version * lockout policy * lint * Update internal/auth/repository/eventsourcing/eventstore/auth_request.go Co-authored-by: Silvan <silvan.reusser@gmail.com> * fix: err message * Update internal/command/setup_step4.go Co-authored-by: Silvan <silvan.reusser@gmail.com> Co-authored-by: Max Peintner <max@caos.ch> Co-authored-by: Livio Amstutz <livio.a@gmail.com> Co-authored-by: Silvan <silvan.reusser@gmail.com>
36 lines
930 B
Go
36 lines
930 B
Go
package command
|
|
|
|
import (
|
|
"context"
|
|
"github.com/caos/logging"
|
|
"github.com/caos/zitadel/internal/domain"
|
|
"github.com/caos/zitadel/internal/eventstore"
|
|
)
|
|
|
|
type Step18 struct {
|
|
LockoutPolicy domain.LockoutPolicy
|
|
}
|
|
|
|
func (s *Step18) Step() domain.Step {
|
|
return domain.Step18
|
|
}
|
|
|
|
func (s *Step18) execute(ctx context.Context, commandSide *Commands) error {
|
|
return commandSide.SetupStep18(ctx, s)
|
|
}
|
|
|
|
func (c *Commands) SetupStep18(ctx context.Context, step *Step18) error {
|
|
fn := func(iam *IAMWriteModel) ([]eventstore.EventPusher, error) {
|
|
iamAgg := IAMAggregateFromWriteModel(&iam.WriteModel)
|
|
addedPolicy := NewIAMLockoutPolicyWriteModel()
|
|
events, err := c.addDefaultLockoutPolicy(ctx, iamAgg, addedPolicy, &step.LockoutPolicy)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
logging.Log("SETUP-3m99ds").Info("default lockout policy set up")
|
|
return []eventstore.EventPusher{events}, nil
|
|
}
|
|
return c.setup(ctx, step, fn)
|
|
}
|