directory creation procedure

This commit is contained in:
nek0 2014-08-14 02:24:28 +02:00
parent 8bbe4d5d02
commit 0ab0552f20
3 changed files with 7 additions and 3 deletions

View file

@ -1,6 +1,9 @@
module Handler.Activate where
import Import as I
import Data.Text
import System.Directory
import System.FilePath
getActivateR :: Text -> Handler Html
getActivateR token = do
@ -10,6 +13,7 @@ getActivateR token = do
setMessage $ [shamlet|<pre>Invalid Token!|]
redirect $ HomeR
Just x -> do
_ <- runDB $ insert $ tokenUser (entityVal x)
userId <- runDB $ insert $ tokenUser (entityVal x)
liftIO $ createDirectory $ "static" </> (unpack $ extractKey userId)
setMessage $ [shamlet|<pre>User activated|]
redirect $ HomeR

View file

@ -8,6 +8,6 @@
/login LoginR GET POST
/logout LogoutR GET
/activate/#Text ActivateR GET
/user/#Text ProfileR GET
/user/#UserId ProfileR GET
/upload UploadR GET POST
/newalbum NewAlbumR GET POST

View file

@ -6,7 +6,7 @@
<li>
<a href=@{LogoutR}>Logout
<li>
<a href=@{UploadR}>Upload image
<a href=@{NewAlbumR}>Create album
$nothing
<li>
<a href=@{LoginR}>Login