Prevent new domain request until new subdomain is correct.
This commit is contained in:
parent
fa4e6703ee
commit
e1dcf5c40b
@ -264,7 +264,9 @@ handleAction = case _ of
|
|||||||
case adduserinp of
|
case adduserinp of
|
||||||
INP_newdomain v -> do
|
INP_newdomain v -> do
|
||||||
H.modify_ _ { newDomainForm { new_domain = v } }
|
H.modify_ _ { newDomainForm { new_domain = v } }
|
||||||
case runParser v DomainParser.domain of
|
case v of
|
||||||
|
"" -> H.modify_ _ { newDomainForm { error_string = Nothing } }
|
||||||
|
otherwise -> case runParser v DomainParser.domain of
|
||||||
Left error_string -> H.modify_ _ { newDomainForm { error_string = Just $ show error_string } }
|
Left error_string -> H.modify_ _ { newDomainForm { error_string = Just $ show error_string } }
|
||||||
Right _ -> H.modify_ _ { newDomainForm { error_string = Nothing } }
|
Right _ -> H.modify_ _ { newDomainForm { error_string = Nothing } }
|
||||||
UpdateSelectedDomain domain -> H.modify_ _ { newDomainForm { selected_domain = domain } }
|
UpdateSelectedDomain domain -> H.modify_ _ { newDomainForm { selected_domain = domain } }
|
||||||
@ -287,10 +289,12 @@ handleAction = case _ of
|
|||||||
{ newDomainForm } <- H.get
|
{ newDomainForm } <- H.get
|
||||||
let new_domain = build_new_domain newDomainForm.new_domain newDomainForm.selected_domain
|
let new_domain = build_new_domain newDomainForm.new_domain newDomainForm.selected_domain
|
||||||
|
|
||||||
case new_domain of
|
case newDomainForm.error_string, new_domain of
|
||||||
"" ->
|
Just error_string, _ ->
|
||||||
|
H.raise $ Log $ UnableToSend $ "You didn't enter a valid new domain: " <> error_string
|
||||||
|
_, "" ->
|
||||||
H.raise $ Log $ UnableToSend "You didn't enter the new domain!"
|
H.raise $ Log $ UnableToSend "You didn't enter the new domain!"
|
||||||
_ -> do
|
Nothing, _ -> do
|
||||||
message <- H.liftEffect
|
message <- H.liftEffect
|
||||||
$ DNSManager.serialize
|
$ DNSManager.serialize
|
||||||
$ DNSManager.MkNewDomain { domain: new_domain }
|
$ DNSManager.MkNewDomain { domain: new_domain }
|
||||||
|
Loading…
Reference in New Issue
Block a user