mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-04 08:25:22 +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,
|
||
|
}
|
||
|
}
|