Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code suggested in Documentation does not work #1855

Open
jaanisfehling opened this issue Dec 7, 2024 · 0 comments
Open

Code suggested in Documentation does not work #1855

jaanisfehling opened this issue Dec 7, 2024 · 0 comments

Comments

@jaanisfehling
Copy link

In the docs it says:

By default this calls defaultLoginHandler, which concatenates plugin widgets and wraps the result in authLayout. Override if you need fancy widget containers, additional functionality, or an entirely custom page. For example, in some applications you may want to prevent the login page being displayed for a user who is already logged in, even if the URL is visited explicitly; this can be done by overriding loginHandler in your instance declaration with something like:

instance YesodAuth App where
...
loginHandler = do
ma <- lift maybeAuthId
when (isJust ma) $
lift $ redirect HomeR -- or any other Handler code you want
defaultLoginHandler

But this does not work for me. Instead I found this to work:

loginHandler :: AuthHandler App Html
loginHandler = do
    ma <- maybeAuthId
    when (isJust ma) $ redirect HomeR
    defaultLoginHandler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant