added generic user route

This commit is contained in:
nek0 2014-08-18 18:08:53 +02:00
parent cfad583b75
commit af988704d6
2 changed files with 12 additions and 1 deletions

View file

@ -18,3 +18,13 @@ getProfileR ownerId = do
return False
defaultLayout $ do
$(widgetFile "profile")
getUserR :: Text -> Handler Html
getUserR ownerName = do
tempOwner <- runDB $ selectFirst [UserName ==. ownerName] []
case tempOwner of
Just (Entity ownerId owner) ->
getProfileR ownerId
Nothing -> do
setMessage "This user does not exist"
redirect $ HomeR

View file

@ -8,7 +8,8 @@
/login LoginR GET POST
/logout LogoutR GET
/activate/#Text ActivateR GET
/user/#UserId ProfileR GET
/profile/#UserId ProfileR GET
/user/#Text UserR GET
/upload UploadR GET POST
/newalbum NewAlbumR GET POST
/album/#AlbumId AlbumR GET