zitadel/internal/v2/repository/policy/events_password_complexity.go

54 lines
1.1 KiB
Go
Raw Normal View History

2020-11-06 17:25:07 +01:00
package policy
import (
"context"
"github.com/caos/zitadel/internal/eventstore/v2"
)
const (
PasswordComplexityPolicyAddedEventType = "policy.password.complexity.added"
)
type PasswordComplexityPolicyAddedEvent struct {
eventstore.BaseEvent `json:"-"`
MinLength int `json:"minLength"`
HasLowercase bool `json:"hasLowercase"`
HasUpperCase bool `json:"hasUppercase"`
HasNumber bool `json:"hasNumber"`
HasSymbol bool `json:"hasSymbol"`
}
func (e *PasswordComplexityPolicyAddedEvent) CheckPrevious() bool {
return true
}
func (e *PasswordComplexityPolicyAddedEvent) Data() interface{} {
return e
}
func NewPasswordComplexityPolicyAddedEvent(
ctx context.Context,
service string,
hasLowerCase,
hasUpperCase,
hasNumber,
hasSymbol bool,
minLength int,
) *PasswordComplexityPolicyAddedEvent {
return &PasswordComplexityPolicyAddedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
ctx,
service,
PasswordComplexityPolicyAddedEventType,
),
HasLowercase: hasLowerCase,
HasNumber: hasNumber,
HasSymbol: hasSymbol,
HasUpperCase: hasUpperCase,
MinLength: minLength,
}
}