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

Define session as guest before redirecting to login page #47

Open
SimonLab opened this issue Apr 7, 2020 · 1 comment
Open

Define session as guest before redirecting to login page #47

SimonLab opened this issue Apr 7, 2020 · 1 comment
Assignees
Labels

Comments

@SimonLab
Copy link
Member

SimonLab commented Apr 7, 2020

linked to #31 (comment)

When the application redirect to the login page this means that either the user is not logged in yet and try to access a "private" page or the session/jwt is not valid anymore.
On the second case before redirecting to the login page we need to make sure to update the session to guest.
We can call the logout function before redirecting or we can directly call logout which in turns makes sure to redirect to the login page

@SimonLab
Copy link
Member Author

SimonLab commented Apr 7, 2020

using Cmd.batch we can first logout then redirect to login page:

                        Http.BadStatus 401 ->
                            -- redirect to login page if not logged in anymore
                            ( { model | error = "Access not authorised" }
                            , Cmd.batch
                                [ Session.logout
                                , Route.replaceUrl (Session.navKey model.session) Route.Login
                                ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant