* added flushSessions :: IO()

* updated TODO
This commit is contained in:
Vincent Ambo 2012-03-13 21:29:06 +01:00
parent eaa9ed5b98
commit f6446aec72
2 changed files with 15 additions and 2 deletions

3
TODO
View file

@ -1,4 +1,3 @@
* handle BlogErrors
* fix sessions
* add readMore link
* add flushSessions :: IO()
* add readMore link

View file

@ -168,6 +168,12 @@ getSession sId =
do b@Blog{..} <- ask
return $ getOne $ blogSessions @= sId
clearSessions :: Update Blog [Session]
clearSessions =
do b@Blog{..} <- get
put $ b { blogSessions = empty }
return []
addUser :: Text -> String -> Update Blog User
addUser un pw =
do b@Blog{..} <- get
@ -203,6 +209,7 @@ $(makeAcidic ''Blog
, 'addUser
, 'getUser
, 'checkUser
, 'clearSessions
])
interactiveUserAdd :: IO ()
@ -215,3 +222,10 @@ interactiveUserAdd = do
pw <- getLine
update' acid (AddUser (pack un) pw)
createCheckpointAndClose acid
flushSessions :: IO ()
flushSessions = do
tbDir <- getEnv "TAZBLOG"
acid <- openLocalStateFrom (tbDir ++ "/BlogState") initialBlogState
update' acid (ClearSessions)
createCheckpointAndClose acid