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

Move login to a 401 page #38

Closed
ning-y opened this issue Jun 6, 2018 · 1 comment
Closed

Move login to a 401 page #38

ning-y opened this issue Jun 6, 2018 · 1 comment

Comments

@ning-y
Copy link
Member

ning-y commented Jun 6, 2018

The current default landing page is News. If the
user clicks on Source Academy, they are brought
to the 'anonymous' (no associated navigation
button) Game component.

If this user is not logged in, they will receive
a pop-up LoginDialog. However, the Game
component will still render. This possesses a
problem with regards to performance, as well as
data (there is no data in state.session to
indicate username, story...)

Furthermore, we expect similar problems if a user
who is not logged in visits directly, via URL, any
page under Academy.


As a solution, we should move the login into its
separate component, 401. When the react router
receives a user request for /academy/*, the
router checks if the user is logged in. If the
user is logged in, the user is routed as per
usual. If not, the user is redirected to the 401
page instead, by-passing the render of Academy
components. When a user successfully logs in via
the 401 page, we call history to return to the
Academy component the user was trying to access.
If the history is empty, default to /academy/game.

@ning-y
Copy link
Member Author

ning-y commented Jun 6, 2018

My bad, was on mobile and had the wrong repo open.

@ning-y ning-y closed this as completed Jun 6, 2018
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