diff --git a/config/routes b/config/routes index 2056d8d..8b5a58c 100644 --- a/config/routes +++ b/config/routes @@ -5,5 +5,3 @@ /robots.txt RobotsR GET / HomeR GET - -/profile ProfileR GET diff --git a/src/Application.hs b/src/Application.hs index ad91def..bdbce5b 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -49,7 +49,6 @@ import System.Log.FastLogger (defaultBufSize, newStdoutLoggerSet, -- Don't forget to add new modules to your cabal file! import Handler.Common import Handler.Home -import Handler.Profile -- This line actually creates our YesodDispatch instance. It is the second half -- of the call to mkYesodData which occurs in Foundation.hs. Please see the diff --git a/src/Foundation.hs b/src/Foundation.hs index af45a8c..1c6860c 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -100,35 +100,14 @@ instance Yesod App where master <- getYesod mmsg <- getMessage - muser <- maybeAuthPair + -- muser <- maybeAuthPair mcurrentRoute <- getCurrentRoute -- Get the breadcrumbs, as defined in the YesodBreadcrumbs instance. (title, parents) <- breadcrumbs -- Define the menu items of the header. - let menuItems = - [ NavbarLeft $ MenuItem - { menuItemLabel = "Home" - , menuItemRoute = HomeR - , menuItemAccessCallback = True - } - , NavbarLeft $ MenuItem - { menuItemLabel = "Profile" - , menuItemRoute = ProfileR - , menuItemAccessCallback = isJust muser - } - , NavbarRight $ MenuItem - { menuItemLabel = "Login" - , menuItemRoute = AuthR LoginR - , menuItemAccessCallback = isNothing muser - } - , NavbarRight $ MenuItem - { menuItemLabel = "Logout" - , menuItemRoute = AuthR LogoutR - , menuItemAccessCallback = isJust muser - } - ] + let menuItems = [] let navbarLeftMenuItems = [x | NavbarLeft x <- menuItems] let navbarRightMenuItems = [x | NavbarRight x <- menuItems] @@ -155,8 +134,6 @@ instance Yesod App where isAuthorized RobotsR _ = return Authorized isAuthorized (StaticR _) _ = return Authorized - isAuthorized ProfileR _ = isAuthenticated - -- This function creates static content files in the static folder -- and names them based on a hash of their content. This allows -- expiration dates to be set far in the future without worry of @@ -189,7 +166,6 @@ instance Yesod App where instance YesodBreadcrumbs App where breadcrumb HomeR = return ("Home", Nothing) breadcrumb (AuthR _) = return ("Login", Just HomeR) - breadcrumb ProfileR = return ("Profile", Just HomeR) breadcrumb _ = return ("home", Nothing) -- How to run database actions. diff --git a/src/Handler/Profile.hs b/src/Handler/Profile.hs deleted file mode 100644 index f0b8102..0000000 --- a/src/Handler/Profile.hs +++ /dev/null @@ -1,15 +0,0 @@ -{-# LANGUAGE NoImplicitPrelude #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE MultiParamTypeClasses #-} -{-# LANGUAGE TypeFamilies #-} -module Handler.Profile where - -import Import - -getProfileR :: Handler Html -getProfileR = do - (_, user) <- requireAuthPair - defaultLayout $ do - setTitle . toHtml $ userIdent user <> "'s User page" - $(widgetFile "profile") diff --git a/test/Handler/ProfileSpec.hs b/test/Handler/ProfileSpec.hs deleted file mode 100644 index 1f96f7f..0000000 --- a/test/Handler/ProfileSpec.hs +++ /dev/null @@ -1,28 +0,0 @@ -{-# LANGUAGE NoImplicitPrelude #-} -{-# LANGUAGE OverloadedStrings #-} -module Handler.ProfileSpec (spec) where - -import TestImport - -spec :: Spec -spec = withApp $ do - - describe "Profile page" $ do - it "asserts no access to my-account for anonymous users" $ do - get ProfileR - statusIs 403 - - it "asserts access to my-account for authenticated users" $ do - userEntity <- createUser "foo" - authenticateAs userEntity - - get ProfileR - statusIs 200 - - it "asserts user's information is shown" $ do - userEntity <- createUser "bar" - authenticateAs userEntity - - get ProfileR - let (Entity _ user) = userEntity - htmlAnyContain ".username" . unpack $ userIdent user