DMARC: better text in selections.
This commit is contained in:
parent
103fb0d643
commit
4181c86c82
@ -55,7 +55,7 @@ import App.Type.ResourceRecord (ResourceRecord, emptyRR
|
||||
, show_qualifier, show_qualifier_char
|
||||
, show_mechanism_type, show_mechanism, to_mechanism
|
||||
, show_modifier_type, show_modifier, to_modifier
|
||||
, all_qualifiers
|
||||
, qualifiers
|
||||
, mechanism_types, qualifier_types, modifier_types)
|
||||
import App.Type.ResourceRecord (Mechanism, Modifier, Qualifier(..)) as RR
|
||||
import App.Type.DKIM as DKIM
|
||||
@ -552,16 +552,23 @@ render state
|
||||
|
||||
, Bulma.hr
|
||||
, Bulma.div_content [Bulma.explanation Explanations.dmarc_policy]
|
||||
, Bulma.selection_field "idDMARCPolicy" "Policy" DMARC_policy (map show DMARC.policies) (show state.dmarc.p)
|
||||
, Bulma.selection_field' "idDMARCPolicy" "Policy" DMARC_policy
|
||||
(A.zip DMARC.policies_txt DMARC.policies_raw)
|
||||
(show state.dmarc.p)
|
||||
, Bulma.div_content [Bulma.explanation Explanations.dmarc_sp_policy]
|
||||
, Bulma.selection_field "idDMARCPolicy_sp" "Policy for subdomains" DMARC_sp_policy
|
||||
(["do not provide policy advice"] <> map show DMARC.policies) (maybe "-" show state.dmarc.sp)
|
||||
, Bulma.selection_field' "idDMARCPolicy_sp" "Policy for subdomains" DMARC_sp_policy
|
||||
(zip_nullable DMARC.policies_txt_with_null DMARC.policies_raw)
|
||||
(maybe "-" show state.dmarc.sp)
|
||||
|
||||
, Bulma.hr
|
||||
, Bulma.div_content [Bulma.explanation Explanations.dmarc_adkim]
|
||||
, Bulma.selection_field "idDMARCadkim" "Consistency Policy for DKIM" DMARC_adkim DMARC.consistency_policies_txt (maybe "-" show state.dmarc.adkim)
|
||||
, Bulma.selection_field' "idDMARCadkim" "Consistency Policy for DKIM" DMARC_adkim
|
||||
(zip_nullable DMARC.consistency_policies_txt DMARC.consistency_policies_raw)
|
||||
(maybe "-" show state.dmarc.adkim)
|
||||
, Bulma.div_content [Bulma.explanation Explanations.dmarc_aspf]
|
||||
, Bulma.selection_field "idDMARCaspf" "Consistency Policy for SPF" DMARC_aspf DMARC.consistency_policies_txt (maybe "-" show state.dmarc.aspf)
|
||||
, Bulma.selection_field' "idDMARCaspf" "Consistency Policy for SPF" DMARC_aspf
|
||||
(zip_nullable DMARC.consistency_policies_txt DMARC.consistency_policies_raw)
|
||||
(maybe "-" show state.dmarc.aspf)
|
||||
|
||||
, Bulma.hr
|
||||
, Bulma.div_content [Bulma.explanation Explanations.dmarc_pct]
|
||||
@ -822,7 +829,7 @@ handleAction = case _ of
|
||||
SPF_Mechanism_v v -> H.modify_ _ { spf_mechanism_v = v }
|
||||
SPF_Modifier_t v -> H.modify_ _ { spf_modifier_t = maybe "redirect" id $ modifier_types A.!! v }
|
||||
SPF_Modifier_v v -> H.modify_ _ { spf_modifier_v = v }
|
||||
SPF_Qualifier v -> H.modify_ _ { _currentRR { q = all_qualifiers A.!! v } }
|
||||
SPF_Qualifier v -> H.modify_ _ { _currentRR { q = qualifiers A.!! v } }
|
||||
SPF_remove_mechanism i ->
|
||||
H.modify_ \s -> s { _currentRR { mechanisms = case s._currentRR.mechanisms of
|
||||
Just ms -> Just (remove_id i $ attach_id 0 ms)
|
||||
|
@ -170,10 +170,13 @@ consistency_policies = [Strict, Relaxed]
|
||||
consistency_policies_txt :: Array String
|
||||
consistency_policies_txt
|
||||
= [ "Do not provide policy advice"
|
||||
, "Strict"
|
||||
, "Relaxed"
|
||||
, "Strict: same domain"
|
||||
, "Relaxed: same organizational domain"
|
||||
]
|
||||
|
||||
consistency_policies_raw :: Array String
|
||||
consistency_policies_raw = map show consistency_policies
|
||||
|
||||
-- | Codec for just encoding a single value of type `ConsistencyPolicy`.
|
||||
codecConsistencyPolicy :: CA.JsonCodec ConsistencyPolicy
|
||||
codecConsistencyPolicy
|
||||
@ -235,6 +238,19 @@ data Policy
|
||||
policies :: Array Policy
|
||||
policies = [None, Quarantine, Reject]
|
||||
|
||||
policies_raw :: Array String
|
||||
policies_raw = map show policies
|
||||
|
||||
policies_txt :: Array String
|
||||
policies_txt =
|
||||
[ "None (let the receiver decide)"
|
||||
, "Quarantine (high spam score, flag, etc.)"
|
||||
, "Reject"
|
||||
]
|
||||
|
||||
policies_txt_with_null :: Array String
|
||||
policies_txt_with_null = [ "Do not provide policy advice" ] <> policies_txt
|
||||
|
||||
-- | Codec for just encoding a single value of type `Policy`.
|
||||
codecPolicy :: CA.JsonCodec Policy
|
||||
codecPolicy = CA.prismaticCodec "Policy" str_to_policy generic_serialization CA.string
|
||||
|
@ -232,8 +232,8 @@ emptyRR
|
||||
}
|
||||
|
||||
data Qualifier = Pass | Neutral | SoftFail | HardFail
|
||||
all_qualifiers :: Array Qualifier
|
||||
all_qualifiers = [Pass, Neutral, SoftFail, HardFail]
|
||||
qualifiers :: Array Qualifier
|
||||
qualifiers = [Pass, Neutral, SoftFail, HardFail]
|
||||
qualifier_types :: Array String
|
||||
qualifier_types = ["pass", "neutral", "soft_fail", "hard_fail"]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user