diff options
Diffstat (limited to 'src/server/LoginSession.hs')
-rw-r--r-- | src/server/LoginSession.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/server/LoginSession.hs b/src/server/LoginSession.hs index 3897b4c..6f6d620 100644 --- a/src/server/LoginSession.hs +++ b/src/server/LoginSession.hs @@ -15,16 +15,18 @@ import Control.Monad.IO.Class (liftIO) import Data.Text (Text) import qualified Data.Text.Encoding as TE +import Conf (Conf) + sessionName :: Text sessionName = "SESSION" sessionKeyFile :: FilePath sessionKeyFile = "sessionKey" -put :: Text -> ActionM () -put value = do +put :: Conf -> Text -> ActionM () +put conf value = do encrypted <- liftIO $ encrypt value - setSimpleCookie sessionName encrypted + setSimpleCookie conf sessionName encrypted encrypt :: Text -> IO Text encrypt value = do @@ -47,5 +49,5 @@ decrypt encrypted = do let decrypted = TE.decodeUtf8 <$> CS.decrypt key (TE.encodeUtf8 encrypted) return decrypted -delete :: ActionM () -delete = deleteCookie sessionName +delete :: Conf -> ActionM () +delete conf = deleteCookie conf sessionName |