Reset the SPF form when necessary.
This commit is contained in:
parent
40c8f71346
commit
41098eed8b
@ -148,6 +148,9 @@ data Action
|
||||
-- | Add a new resource record to the zone.
|
||||
| AddRR AcceptedRRTypes ResourceRecord
|
||||
|
||||
-- | Reset the different values of SPF modal (mechanisms, modifiers, etc.).
|
||||
| ResetSPF
|
||||
|
||||
-- | Save the changes done in an already existing resource record.
|
||||
| SaveRR ResourceRecord
|
||||
|
||||
@ -517,6 +520,7 @@ handleAction = case _ of
|
||||
CancelModal -> do
|
||||
H.modify_ _ { rr_modal = NoModal }
|
||||
H.modify_ _ { _currentRR_errors = [] }
|
||||
handleAction $ ResetSPF
|
||||
|
||||
-- | Create the RR modal.
|
||||
DeleteRRModal rr_id -> do
|
||||
@ -646,6 +650,14 @@ handleAction = case _ of
|
||||
H.modify_ _ { _currentRR_errors = [] }
|
||||
handleAction $ SaveRR rr
|
||||
|
||||
ResetSPF -> do
|
||||
H.modify_ _ { spf_mechanism_q = "pass"
|
||||
, spf_mechanism_t = "a"
|
||||
, spf_mechanism_v = ""
|
||||
, spf_modifier_t = "redirect"
|
||||
, spf_modifier_v = ""
|
||||
}
|
||||
|
||||
SaveRR rr -> do
|
||||
state <- H.get
|
||||
H.raise $ Log $ SystemLog $ "Updating RR " <> show rr.rrid
|
||||
@ -654,6 +666,7 @@ handleAction = case _ of
|
||||
$ DNSManager.serialize
|
||||
$ DNSManager.MkUpdateRR { domain: state._domain, rr: rr }
|
||||
H.raise $ MessageToSend message
|
||||
handleAction $ ResetSPF
|
||||
|
||||
RemoveRR rr_id -> do
|
||||
{ _domain } <- H.get
|
||||
@ -714,6 +727,7 @@ handleAction = case _ of
|
||||
[] -> Nothing
|
||||
v -> Just v
|
||||
H.modify_ _ { _currentRR { mechanisms = new_value }}
|
||||
handleAction $ ResetSPF
|
||||
|
||||
SPF_Modifier_Add -> do
|
||||
state <- H.get
|
||||
@ -725,6 +739,7 @@ handleAction = case _ of
|
||||
[] -> Nothing
|
||||
v -> Just v
|
||||
H.modify_ _ { _currentRR { modifiers = new_value }}
|
||||
handleAction $ ResetSPF
|
||||
|
||||
DKIM_hash_algo v -> H.modify_ _ { dkim { h = DKIM.hash_algos A.!! v } }
|
||||
DKIM_sign_algo v -> H.modify_ _ { dkim { k = DKIM.sign_algos A.!! v } }
|
||||
|
Loading…
Reference in New Issue
Block a user