diff options
author | Joris | 2021-01-03 13:40:40 +0100 |
---|---|---|
committer | Joris | 2021-01-03 13:54:20 +0100 |
commit | 11052951b74b9ad4b6a9412ae490086235f9154b (patch) | |
tree | 64526ac926c1bf470ea113f6cac8a33158684e8d /server/src/Secure.hs | |
parent | 371449b0e312a03162b78797b83dee9d81706669 (diff) |
Rewrite in Rust
Diffstat (limited to 'server/src/Secure.hs')
-rw-r--r-- | server/src/Secure.hs | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/server/src/Secure.hs b/server/src/Secure.hs deleted file mode 100644 index a30941f..0000000 --- a/server/src/Secure.hs +++ /dev/null @@ -1,31 +0,0 @@ -module Secure - ( loggedAction - ) where - -import Control.Monad.IO.Class (liftIO) -import qualified Data.Text.Lazy as TL -import qualified Network.HTTP.Types.Status as HTTP -import Web.Scotty - -import Common.Model (User) -import qualified Common.Msg as Msg - -import qualified LoginSession -import qualified Model.Query as Query -import qualified Persistence.User as UserPersistence - -loggedAction :: (User -> ActionM ()) -> ActionM () -loggedAction action = do - maybeToken <- LoginSession.get - case maybeToken of - Just token -> do - maybeUser <- liftIO . Query.run . UserPersistence.get $ token - case maybeUser of - Just user -> - action user - Nothing -> do - status HTTP.forbidden403 - html . TL.fromStrict . Msg.get $ Msg.Secure_Unauthorized - Nothing -> do - status HTTP.forbidden403 - html . TL.fromStrict . Msg.get $ Msg.Secure_Forbidden |