From 41098eed8b2982fa31932c40ebfaaf3272ed1543 Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Thu, 11 Apr 2024 12:52:32 +0200 Subject: [PATCH] Reset the SPF form when necessary. --- src/App/Page/Zone.purs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/App/Page/Zone.purs b/src/App/Page/Zone.purs index 5b1e8c1..2d3f7f8 100644 --- a/src/App/Page/Zone.purs +++ b/src/App/Page/Zone.purs @@ -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 } }