mirror of
https://github.com/andwati/zitadel.git
synced 2026-12-03 09:28:55 +00:00
54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
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,
|
|
}
|
|
}
|