diff options
author | William Carroll <wpcarro@gmail.com> | 2021-01-22T11·13+0000 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2021-01-22T11·13+0000 |
commit | 42ba9cce79852f992302df92cb7ab61a08a53fb3 (patch) | |
tree | a1903f7f74985c23b35622920cf3866da1a1f7c0 /assessments/tt/src/Types.hs | |
parent | e326b0da45a948668f523d5f715660981a9874c2 (diff) |
Prefer POST /verify to GET /verify
To make things easier for testing, I setup the /verify endpoint as a GET, so that I could email myself clickable URLs. With POST /verify, my options are: - send email with an HTML button and form that POSTs to /verify - email myself the curl instruction I'm preferring the latter for now...
Diffstat (limited to 'assessments/tt/src/Types.hs')
-rw-r--r-- | assessments/tt/src/Types.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/assessments/tt/src/Types.hs b/assessments/tt/src/Types.hs index 00fa09ccc140..6b06a39694fc 100644 --- a/assessments/tt/src/Types.hs +++ b/assessments/tt/src/Types.hs @@ -420,6 +420,19 @@ instance ToField RegistrationSecret where toField (RegistrationSecret secretUUID) = secretUUID |> UUID.toText |> SQLText +instance FromJSON RegistrationSecret + +data VerifyAccountRequest = VerifyAccountRequest + { verifyAccountRequestUsername :: Username + , verifyAccountRequestSecret :: RegistrationSecret + } deriving (Eq, Show) + +instance FromJSON VerifyAccountRequest where + parseJSON = withObject "VerifyAccountRequest" $ \x -> do + verifyAccountRequestUsername <- x .: "username" + verifyAccountRequestSecret <- x .: "secret" + pure VerifyAccountRequest{..} + data PendingAccount = PendingAccount { pendingAccountSecret :: RegistrationSecret , pendingAccountUsername :: Username |