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P22GOB535QC
HMDM3B557TO5RYP2IGFFC2C2VN6HYZTDQ47CJY2O37BW55DSMFZAC
AL37SVTCKRSG4HG2PCYK5Z7QSIZZH5JHH4Q2VLMXFAXSAQRFFG4QC
JFOEOFGA4CQR2LW43IVQGDZSPVJAD4KDN2DZMZXGM2QDIUD7AVCAC
IZEVQF627FA7VV25KJAWYWGGC35LZUUBBQRPN5ZAINTQLPEDRTEAC
EMVTF2IWNQGRL44FC4JNG5FYYQTZSFPNM6SOM7IAEH6T7PPK2NVAC
I2KHGVD44KT4MQJXGCTVSQKMBO6TVCY72F26TLXGWRL6PHGF6RNQC
NEDDHXUK3GNFMOFO3KLU7NRIHCTYNWBT3D6HTKZAOXFDE6HMDZ6AC
MB5SHULBN3WP7TGUWZDP6BRGP423FTYKF67T5IF5YHHLNXKQ5REAC
2XQD6KKKD6QVHFHAEMVE3XXY7X2T7BLTLL7XIILZAXNJJH2YONUQC
ADMKQQGCGVSHHIMVQ4XFRDCG544SBJCYALSKZV45CQQBZ4ACUH2AC
import Halogen as H
import Halogen.HTML.Core (ClassName(..))
import Halogen.HTML as HH
import Halogen.HTML.CSS as CSS
import Halogen.HTML.Events as E
import Web.Event.Event as WE
import Halogen.HTML.Properties as P
import CSS (backgroundImage, url)
import Landkit.Card as Card
import Aftok.Types (System)
pure ZAddrCheckOK
result <- get RF.ignore ("/api/validate_zaddr?zaddr=" <> zaddr)
case result of
Left err -> do
log ("ZAddr validation failed: " <> printError err)
pure ZAddrCheckInvalid
Right r | r.status == StatusCode 200 -> do
pure ZAddrCheckValid
Right r -> do
log ("ZAddr was determined to be invalid: " <> r.statusText)
pure ZAddrCheckInvalid
RecoverByEmail _ => "email"
RecoverByZAddr _ => "zaddr"
, email: case req.recoverBy of
RecoverByEmail email -> Just email
RecoverByZAddr _ -> Nothing
, zaddr: case req.recoverBy of
RecoverByEmail _ -> Nothing
RecoverByZAddr zaddr -> Just zaddr
RecoverByEmail _ -> "email"
RecoverByZAddr _ -> "zaddr"
, recoveryEmail: case req.recoverBy of
RecoverByEmail email -> Just email
RecoverByZAddr _ -> Nothing
, recoveryZAddr: case req.recoverBy of
RecoverByEmail _ -> Nothing
RecoverByZAddr zaddr -> Just zaddr
Left err -> log ("Registration failed: " <> printError err)
Right r -> log ("Registration status: " <> show r.status)
Left err -> do
log ("Registration failed: " <> printError err)
pure (ServiceError Nothing $ printError err)
Right r | r.status == StatusCode 200 -> do
log "Registration succeeded!"
pure SignupOK
Right r | r.status == StatusCode 403 -> do
log ("Registration failed: Capcha Invalid")
pure CaptchaInvalid
Right r | r.status == StatusCode 400 -> do
log ("Registration failed: Z-Address Invalid")
pure ZAddrInvalid
Right r -> do
log ("Registration failed: " <> r.statusText)
pure $ ServiceError (Just r.status) r.statusText
Acc.SignupOK -> H.raise (SignupComplete $ req.username)
Acc.CaptchaInvalid -> H.modify_ (_ { signupErrors = [CaptchaError] })
Acc.ZAddrInvalid -> H.modify_ (_ { signupErrors = [ZAddrInvalid] })
Acc.UsernameTaken -> H.modify_ (_ { signupErrors = [UsernameTaken] })
Acc.SignupOK -> H.raise (SignupComplete $ req.username)
Acc.CaptchaInvalid -> H.modify_ (_ { signupErrors = [CaptchaError] })
Acc.ZAddrInvalid -> H.modify_ (_ { signupErrors = [ZAddrInvalid] })
Acc.UsernameTaken -> H.modify_ (_ { signupErrors = [UsernameTaken] })
Acc.ServiceError c m -> H.modify_ (_ { signupErrors = [APIError { status: c, message: m }]})
{ _customer :: u
, _billable :: b
, _startTime :: C.UTCTime
, _endTime :: Maybe C.UTCTime
{ _customer :: u
, _billable :: b
, _contactChannel :: ContactChannel
, _startTime :: C.UTCTime
, _endTime :: Maybe C.UTCTime
checkZAddrHandler :: RegisterOps IO -> S.Handler App App ZAddr
checkZAddrHandler ops = do
params <- S.getParams
zaddrBytes <- maybe (snapError 400 "zaddr parameter is required")
pure
(listToMaybe =<< M.lookup "zaddr" params)
zaddrEither <- liftIO $ parseZAddr ops (T.decodeUtf8 zaddrBytes)
case zaddrEither of
Left _ ->
snapError 400 "The Z-Address provided for account recovery was invalid."
Right zaddr ->
pure zaddr