mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 00:17: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:
@@ -9,9 +9,10 @@ import (
|
||||
type PolicyDomainWriteModel struct {
|
||||
eventstore.WriteModel
|
||||
|
||||
UserLoginMustBeDomain bool
|
||||
ValidateOrgDomains bool
|
||||
State domain.PolicyState
|
||||
UserLoginMustBeDomain bool
|
||||
ValidateOrgDomains bool
|
||||
SMTPSenderAddressMatchesInstanceDomain bool
|
||||
State domain.PolicyState
|
||||
}
|
||||
|
||||
func (wm *PolicyDomainWriteModel) Reduce() error {
|
||||
@@ -20,6 +21,7 @@ func (wm *PolicyDomainWriteModel) Reduce() error {
|
||||
case *policy.DomainPolicyAddedEvent:
|
||||
wm.UserLoginMustBeDomain = e.UserLoginMustBeDomain
|
||||
wm.ValidateOrgDomains = e.ValidateOrgDomains
|
||||
wm.SMTPSenderAddressMatchesInstanceDomain = e.SMTPSenderAddressMatchesInstanceDomain
|
||||
wm.State = domain.PolicyStateActive
|
||||
case *policy.DomainPolicyChangedEvent:
|
||||
if e.UserLoginMustBeDomain != nil {
|
||||
@@ -28,6 +30,9 @@ func (wm *PolicyDomainWriteModel) Reduce() error {
|
||||
if e.ValidateOrgDomains != nil {
|
||||
wm.ValidateOrgDomains = *e.ValidateOrgDomains
|
||||
}
|
||||
if e.SMTPSenderAddressMatchesInstanceDomain != nil {
|
||||
wm.SMTPSenderAddressMatchesInstanceDomain = *e.SMTPSenderAddressMatchesInstanceDomain
|
||||
}
|
||||
}
|
||||
}
|
||||
return wm.WriteModel.Reduce()
|
||||
|
Reference in New Issue
Block a user