Skip to content

Commit

Permalink
login: use authDummy for login
Browse files Browse the repository at this point in the history
  • Loading branch information
3v0k4 committed Jul 21, 2019
1 parent 4fea7c6 commit 76c4347
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/Foundation.hs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ instance YesodAuth App where


-- Where to send a user after successful login -- Where to send a user after successful login
loginDest :: App -> Route App loginDest :: App -> Route App
loginDest _ = HomeR loginDest _ = PostsR
-- Where to send a user after logout -- Where to send a user after logout
logoutDest :: App -> Route App logoutDest :: App -> Route App
logoutDest _ = HomeR logoutDest _ = HomeR
-- Override the above two destinations when a Referer: header is present -- Override the above two destinations when a Referer: header is present
redirectToReferer :: App -> Bool redirectToReferer :: App -> Bool
redirectToReferer _ = True redirectToReferer _ = False


authenticate :: (MonadHandler m, HandlerSite m ~ App) authenticate :: (MonadHandler m, HandlerSite m ~ App)
=> Creds App -> m (AuthenticationResult App) => Creds App -> m (AuthenticationResult App)
Expand All @@ -261,11 +261,11 @@ instance YesodAuth App where
, userPassword = Nothing , userPassword = Nothing
} }


authLayout = liftHandler . emptyLayout

-- You can add other plugins like Google Email, email or OAuth here -- You can add other plugins like Google Email, email or OAuth here
authPlugins :: App -> [AuthPlugin App] authPlugins :: App -> [AuthPlugin App]
authPlugins app = [authOpenId Claimed []] ++ extraAuthPlugins authPlugins _app = [authDummy]
-- Enable authDummy login if enabled.
where extraAuthPlugins = [authDummy | appAuthDummyLogin $ appSettings app]


-- | Access function to determine if a user is logged in. -- | Access function to determine if a user is logged in.
isAuthenticated :: Handler AuthResult isAuthenticated :: Handler AuthResult
Expand Down
4 changes: 1 addition & 3 deletions src/Handler/Landing.hs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ loginForm =


getLandingR :: Handler Html getLandingR :: Handler Html
getLandingR = do getLandingR = do
(widget, enctype) <- generateFormPost loginForm redirect $ AuthR LoginR
emptyLayout $ do
$(widgetFile "landing")


postLandingR :: Handler Html postLandingR :: Handler Html
postLandingR = do postLandingR = do
Expand Down

0 comments on commit 76c4347

Please sign in to comment.