directory creation procedure
This commit is contained in:
parent
8bbe4d5d02
commit
0ab0552f20
3 changed files with 7 additions and 3 deletions
|
@ -1,6 +1,9 @@
|
||||||
module Handler.Activate where
|
module Handler.Activate where
|
||||||
|
|
||||||
import Import as I
|
import Import as I
|
||||||
|
import Data.Text
|
||||||
|
import System.Directory
|
||||||
|
import System.FilePath
|
||||||
|
|
||||||
getActivateR :: Text -> Handler Html
|
getActivateR :: Text -> Handler Html
|
||||||
getActivateR token = do
|
getActivateR token = do
|
||||||
|
@ -10,6 +13,7 @@ getActivateR token = do
|
||||||
setMessage $ [shamlet|<pre>Invalid Token!|]
|
setMessage $ [shamlet|<pre>Invalid Token!|]
|
||||||
redirect $ HomeR
|
redirect $ HomeR
|
||||||
Just x -> do
|
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|]
|
setMessage $ [shamlet|<pre>User activated|]
|
||||||
redirect $ HomeR
|
redirect $ HomeR
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
/login LoginR GET POST
|
/login LoginR GET POST
|
||||||
/logout LogoutR GET
|
/logout LogoutR GET
|
||||||
/activate/#Text ActivateR GET
|
/activate/#Text ActivateR GET
|
||||||
/user/#Text ProfileR GET
|
/user/#UserId ProfileR GET
|
||||||
/upload UploadR GET POST
|
/upload UploadR GET POST
|
||||||
/newalbum NewAlbumR GET POST
|
/newalbum NewAlbumR GET POST
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<li>
|
<li>
|
||||||
<a href=@{LogoutR}>Logout
|
<a href=@{LogoutR}>Logout
|
||||||
<li>
|
<li>
|
||||||
<a href=@{UploadR}>Upload image
|
<a href=@{NewAlbumR}>Create album
|
||||||
$nothing
|
$nothing
|
||||||
<li>
|
<li>
|
||||||
<a href=@{LoginR}>Login
|
<a href=@{LoginR}>Login
|
||||||
|
|
Loading…
Reference in a new issue