DMARC: interface to add and remove RUA or RUF mail addresses (with report size limit).
This commit is contained in:
parent
5cc38c7269
commit
e3bbe9ad33
@ -182,6 +182,12 @@ data Action
|
||||
-- | Add a SPF modifier to the currently modified (SPF) entry (see `_currentRR`).
|
||||
| SPF_Modifier_Add
|
||||
|
||||
-- | Change the temporary mail address for DMARC.
|
||||
| DMARC_mail String
|
||||
|
||||
-- | Change the temporary report size limit for DMARC.
|
||||
| DMARC_mail_limit String
|
||||
|
||||
-- | Add a new mail address to the DMARC rua list.
|
||||
| DMARC_rua_Add
|
||||
|
||||
@ -545,8 +551,23 @@ render state
|
||||
, Bulma.box_input "idDMARCpct" "% of dropped emails" "100" DMARC_pct (maybe "100" show state.dmarc.pct)
|
||||
, Bulma.hr
|
||||
, Bulma.selection_field "idDMARCfo" "When to send a report" DMARC_fo DMARC.report_occasions_txt (maybe "-" show state.dmarc.fo)
|
||||
, Bulma.hr
|
||||
, maybe (Bulma.p "no rua") (display_dmarc_mail_addresses DMARC_remove_rua) current_ruas
|
||||
, maybe (Bulma.p "no ruf") (display_dmarc_mail_addresses DMARC_remove_ruf) current_rufs
|
||||
, Bulma.box_input "idDMARCmail" "Address to contact" "" DMARC_mail state.dmarc_mail
|
||||
, Bulma.box_input "idDMARCmaillimit" "Report size limit (in KB)" "" DMARC_mail_limit (maybe "0" show state.dmarc_mail_limit)
|
||||
, Bulma.level [ Bulma.btn "New address for aggregated report" DMARC_rua_Add
|
||||
, Bulma.btn "New address for specific report" DMARC_ruf_Add
|
||||
]
|
||||
]
|
||||
|
||||
current_ruas = case state._currentRR.dmarc of
|
||||
Nothing -> Nothing
|
||||
Just dmarc -> dmarc.rua
|
||||
current_rufs = case state._currentRR.dmarc of
|
||||
Nothing -> Nothing
|
||||
Just dmarc -> dmarc.ruf
|
||||
|
||||
display_domain_side = (if state._currentRR.name == (state._domain <> ".") then "" else "." <> state._domain)
|
||||
newtokenbtn = Bulma.btn (maybe "🏁 Ask for a token" (\_ -> "🏁 Ask for a new token") state._currentRR.token) (NewToken state._currentRR.rrid)
|
||||
foot_content x =
|
||||
@ -798,6 +819,8 @@ handleAction = case _ of
|
||||
H.modify_ _ { _currentRR { modifiers = new_value }}
|
||||
handleAction $ ResetTemporaryValues
|
||||
|
||||
DMARC_mail v -> H.modify_ _ { dmarc_mail = v }
|
||||
DMARC_mail_limit v -> H.modify_ _ { dmarc_mail_limit = Just $ fromMaybe 0 $ fromString v }
|
||||
DMARC_rua_Add -> do
|
||||
state <- H.get
|
||||
let current_ruas = case state._currentRR.dmarc of
|
||||
@ -1093,6 +1116,18 @@ display_modifiers ms =
|
||||
, HH.td_ [ Bulma.alert_btn "x" (SPF_remove_modifier i) ]
|
||||
]
|
||||
|
||||
display_dmarc_mail_addresses :: forall w. (Int -> Action) -> Array DMARC.DMARCURI -> HH.HTML w Action
|
||||
display_dmarc_mail_addresses f ms =
|
||||
Bulma.box_ C.has_background_warning_light
|
||||
[ Bulma.table [] [ Bulma.dmarc_dmarcuri_table_header, HH.tbody_ $ map render_dmarcuri_row $ attach_id 0 ms] ]
|
||||
where
|
||||
render_dmarcuri_row :: (Tuple Int DMARC.DMARCURI) -> HH.HTML w Action
|
||||
render_dmarcuri_row (Tuple i m) = HH.tr_
|
||||
[ HH.td_ [ Bulma.p m.mail ]
|
||||
, HH.td_ [ Bulma.p $ maybe "(no size limit)" show m.limit ]
|
||||
, HH.td_ [ Bulma.alert_btn "x" (f i) ]
|
||||
]
|
||||
|
||||
baseRecords :: Array String
|
||||
baseRecords = [ "A", "AAAA", "CNAME", "TXT", "NS" ]
|
||||
|
||||
|
@ -77,6 +77,14 @@ modifier_table_header
|
||||
]
|
||||
]
|
||||
|
||||
dmarc_dmarcuri_table_header :: forall w i. HH.HTML w i
|
||||
dmarc_dmarcuri_table_header
|
||||
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Email address" ]
|
||||
, HH.th_ [ HH.text "Report size limit" ]
|
||||
, HH.th_ [ HH.text "" ]
|
||||
]
|
||||
]
|
||||
|
||||
simple_table_header :: forall w i. HH.HTML w i
|
||||
simple_table_header
|
||||
= HH.thead_ [ HH.tr_ [ HH.th_ [ HH.text "Type" ]
|
||||
|
Loading…
Reference in New Issue
Block a user