diff options
author | William Carroll <wpcarro@gmail.com> | 2020-08-04T08·19+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-08-04T08·19+0100 |
commit | ee8e75231cd9d3d4aa3ffbbfa0e3b8511712e1ee (patch) | |
tree | 6264013fea0cfc8489f3d9f24cdc7ae1d63a9f50 /src/App.hs | |
parent | 9a19942c037ec62700c41c235154ff38816c0a3a (diff) |
Set -Wall and fix warnings
I think setting -Wall is a sensible default and @dmjio confirmed this. After putting this in my project's .ghci file, a few dozen warnings emerged. This commit changes the code that causes the warnings.
Diffstat (limited to 'src/App.hs')
-rw-r--r-- | src/App.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/App.hs b/src/App.hs index e56e7c1875f5..6a7de73a822f 100644 --- a/src/App.hs +++ b/src/App.hs @@ -11,7 +11,6 @@ import Control.Monad.IO.Class (liftIO) import Data.String.Conversions (cs) import Data.Text (Text) import Servant -import Servant.Server.Internal.ServerError import API import Utils import Web.Cookie @@ -20,10 +19,7 @@ import qualified Network.Wai.Handler.Warp as Warp import qualified Network.Wai.Middleware.Cors as Cors import qualified System.Random as Random import qualified Email as Email -import qualified Crypto.KDF.BCrypt as BC -import qualified Data.Text.Encoding as TE import qualified Data.UUID as UUID -import qualified Data.UUID.V4 as UUID import qualified Types as T import qualified Accounts as Accounts import qualified Auth as Auth @@ -48,7 +44,7 @@ sendVerifyEmail :: T.Config -> T.Email -> T.RegistrationSecret -> IO (Either Email.SendError Email.SendSuccess) -sendVerifyEmail T.Config{..} (T.Username username) email@(T.Email to) (T.RegistrationSecret secretUUID) = do +sendVerifyEmail T.Config{..} (T.Username username) email (T.RegistrationSecret secretUUID) = do Email.send mailgunAPIKey subject (cs body) email where subject = "Please confirm your account" @@ -115,11 +111,13 @@ server config@T.Config{..} = createAccount createAccountRequestPassword createAccountRequestRole createAccountRequestEmail - liftIO $ sendVerifyEmail config + res <- liftIO $ sendVerifyEmail config createAccountRequestUsername createAccountRequestEmail secretUUID - pure NoContent + case res of + Left _ -> undefined + Right _ -> pure NoContent verifyAccount :: Text -> T.RegistrationSecret -> Handler NoContent verifyAccount username secretUUID = do @@ -239,8 +237,10 @@ server config@T.Config{..} = createAccount secretUUID inviteUserRequestEmail inviteUserRequestRole - liftIO $ sendInviteEmail config inviteUserRequestEmail secretUUID - pure NoContent + res <- liftIO $ sendInviteEmail config inviteUserRequestEmail secretUUID + case res of + Left _ -> undefined + Right _ -> pure NoContent acceptInvitation :: T.AcceptInvitationRequest -> Handler NoContent acceptInvitation T.AcceptInvitationRequest{..} = do |