@@ -71,7 +71,7 @@ type LoginDescription = Description "Try to log in with the given email\n\nRespo
7171
7272type LogoutDescription = Description "Log out with the given cookie"
7373
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."
7575
7676type 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`."
7777
@@ -159,8 +159,10 @@ verifyToken (Just cookie) code = do
159159 case mbToken of
160160 Nothing -> throwError err400
161161 (Just (AuthenticationCookieData uId tokenData)) -> do
162− _ <- runQ invalidToken $ tryVerifyToken uId tokenData code
163− return NoContent
162+ token <- runQ invalidToken $ tryVerifyToken uId tokenData code
163+ case token of
164+ Just _ -> return NoContent
165+ Nothing -> throwError err403
164166
165167logOut :: Maybe String -> App (Headers '[Header "Set-Cookie" String] NoContent)
166168logOut cookie' = do