mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:37:32 +00:00
feat: restrict smtp sender address (#3637)
* fix: check if sender address is custom domain * fix: check if sender address is custom domain * fix: check if sender address is custom domain Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
@@ -19,8 +19,9 @@ const (
|
||||
type DomainPolicyAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
UserLoginMustBeDomain bool `json:"userLoginMustBeDomain,omitempty"`
|
||||
ValidateOrgDomains bool `json:"validateOrgDomains,omitempty"`
|
||||
UserLoginMustBeDomain bool `json:"userLoginMustBeDomain,omitempty"`
|
||||
ValidateOrgDomains bool `json:"validateOrgDomains,omitempty"`
|
||||
SMTPSenderAddressMatchesInstanceDomain bool `json:"smtpSenderAddressMatchesInstanceDomain,omitempty"`
|
||||
}
|
||||
|
||||
func (e *DomainPolicyAddedEvent) Data() interface{} {
|
||||
@@ -34,13 +35,15 @@ func (e *DomainPolicyAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCo
|
||||
func NewDomainPolicyAddedEvent(
|
||||
base *eventstore.BaseEvent,
|
||||
userLoginMustBeDomain,
|
||||
validateOrgDomains bool,
|
||||
validateOrgDomains,
|
||||
smtpSenderAddressMatchesInstanceDomain bool,
|
||||
) *DomainPolicyAddedEvent {
|
||||
|
||||
return &DomainPolicyAddedEvent{
|
||||
BaseEvent: *base,
|
||||
UserLoginMustBeDomain: userLoginMustBeDomain,
|
||||
ValidateOrgDomains: validateOrgDomains,
|
||||
BaseEvent: *base,
|
||||
UserLoginMustBeDomain: userLoginMustBeDomain,
|
||||
ValidateOrgDomains: validateOrgDomains,
|
||||
SMTPSenderAddressMatchesInstanceDomain: smtpSenderAddressMatchesInstanceDomain,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,8 +63,9 @@ func DomainPolicyAddedEventMapper(event *repository.Event) (eventstore.Event, er
|
||||
type DomainPolicyChangedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
UserLoginMustBeDomain *bool `json:"userLoginMustBeDomain,omitempty"`
|
||||
ValidateOrgDomains *bool `json:"validateOrgDomains,omitempty"`
|
||||
UserLoginMustBeDomain *bool `json:"userLoginMustBeDomain,omitempty"`
|
||||
ValidateOrgDomains *bool `json:"validateOrgDomains,omitempty"`
|
||||
SMTPSenderAddressMatchesInstanceDomain *bool `json:"smtpSenderAddressMatchesInstanceDomain,omitempty"`
|
||||
}
|
||||
|
||||
func (e *DomainPolicyChangedEvent) Data() interface{} {
|
||||
@@ -102,6 +106,12 @@ func ChangeValidateOrgDomains(validateOrgDomain bool) func(*DomainPolicyChangedE
|
||||
}
|
||||
}
|
||||
|
||||
func ChangeSMTPSenderAddressMatchesInstanceDomain(smtpSenderAddressMatchesInstanceDomain bool) func(*DomainPolicyChangedEvent) {
|
||||
return func(e *DomainPolicyChangedEvent) {
|
||||
e.SMTPSenderAddressMatchesInstanceDomain = &smtpSenderAddressMatchesInstanceDomain
|
||||
}
|
||||
}
|
||||
|
||||
func DomainPolicyChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
e := &DomainPolicyChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
|
Reference in New Issue
Block a user