Don't try to parse empty email fields

This commit is contained in:
Saku Laesvuori 2023-10-31 13:33:20 +02:00
parent 3816c15ce6
commit b3737b312b
Signed by: slaesvuo
GPG Key ID: 257D284A2A1D3A32
1 changed files with 1 additions and 0 deletions

View File

@ -17,6 +17,7 @@ emailField = Field
{ fieldParse = \rawValues _ -> { fieldParse = \rawValues _ ->
case rawValues of case rawValues of
[] -> pure $ Right Nothing [] -> pure $ Right Nothing
[""] -> pure $ Right Nothing
[x] -> pure $ maybe (Left "could not parse as an email address") (Right . Just) $ toEmail x [x] -> pure $ maybe (Left "could not parse as an email address") (Right . Just) $ toEmail x
_ -> pure $ Left $ "Expected one value" _ -> pure $ Left $ "Expected one value"
, fieldView = \id name otherAttributes result isRequired -> , fieldView = \id name otherAttributes result isRequired ->