@@ -71,7 +71,7 @@ type LoginDescription = Description "Try to log in with the given email\n\nRespo
72type LogoutDescription = Description "Log out with the given cookie"
72type LogoutDescription = Description "Log out with the given cookie"
74−type VerifyDescription = Description "Verify token with the verification code from the user.\n\nReturns 400 if the token was not supplied.\n\nReturns 498 if the token was parsed but is invalid.\n\n"
74+type VerifyDescription = Description "Verify token with the verification code from the user.\n\nReturns 400 if the token was not supplied.\n\nReturns 498 if the token was parsed but is invalid.\n\nRetusn 403 if the token/code compination is invalid."
76type RegisterDescription = Description "Register the user for a new account.\n\nReturns 409 if a user can not be created. (Most likely the email is already registered).\n\nSets the token if creation was successful.\n\nYou should prompt user for code and verify the token with `/verify`."
76type RegisterDescription = Description "Register the user for a new account.\n\nReturns 409 if a user can not be created. (Most likely the email is already registered).\n\nSets the token if creation was successful.\n\nYou should prompt user for code and verify the token with `/verify`."
@@ -159,8 +159,10 @@ verifyToken (Just cookie) code = do
159 case mbToken of
159 case mbToken of
160 Nothing -> throwError err400
160 Nothing -> throwError err400
161 (Just (AuthenticationCookieData uId tokenData)) -> do
161 (Just (AuthenticationCookieData uId tokenData)) -> do
162− _ <- runQ invalidToken $ tryVerifyToken uId tokenData code
162+ token <- runQ invalidToken $ tryVerifyToken uId tokenData code
163− return NoContent
164+ Just _ -> return NoContent
165+ Nothing -> throwError err403
165logOut :: Maybe String -> App (Headers '[Header "Set-Cookie" String] NoContent)
167logOut :: Maybe String -> App (Headers '[Header "Set-Cookie" String] NoContent)
166logOut cookie' = do
168logOut cookie' = do