diff options
Diffstat (limited to 'src/server/Secure.hs')
-rw-r--r-- | src/server/Secure.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/server/Secure.hs b/src/server/Secure.hs index f563f23..93d5a60 100644 --- a/src/server/Secure.hs +++ b/src/server/Secure.hs @@ -11,14 +11,17 @@ import Network.HTTP.Types.Status (forbidden403) import Database.Persist (Entity, entityVal) +import Data.Text (Text) +import Data.Text.Lazy (fromStrict) + import Model.User (getUser) import Model.SignIn (getSignIn) import Model.Database +import Model.Message (getMessage) +import qualified Model.Message.Key as Key import Control.Monad.IO.Class (liftIO) -import Data.Text (Text) - import qualified LoginSession loggedAction :: (Entity User -> ActionM ()) -> ActionM () @@ -32,10 +35,10 @@ loggedAction action = do action user Nothing -> do status forbidden403 - html "You are not authorized to logged in" + html . fromStrict . getMessage $ Key.UnauthorizedSignIn Nothing -> do status forbidden403 - html "You need to be logged in to perform this action" + html . fromStrict . getMessage $ Key.Forbidden getUserFromToken :: Text -> Persist (Maybe (Entity User)) getUserFromToken token = do |