Skip to content
This repository has been archived by the owner on Jun 27, 2020. It is now read-only.

User can log out and only view pages when logged in #63

Open
2 tasks
hpjaj opened this issue Dec 8, 2018 · 7 comments
Open
2 tasks

User can log out and only view pages when logged in #63

hpjaj opened this issue Dec 8, 2018 · 7 comments

Comments

@hpjaj
Copy link
Contributor

hpjaj commented Dec 8, 2018

Background

Authenticated users can access pages, guests cannot.

Definition of Done

  • All pages can only be accessed by logged in users
  • There is a logout button that logs a user out
@RobAWilkinson
Copy link
Member

@hpjaj I can take care of this, theres some new approaches in react-router 4 I believe. Could be a fun one for you to tackle too.

@hpjaj
Copy link
Contributor Author

hpjaj commented Dec 9, 2018

@RobAWilkinson Yeah man, it’s all you! I believe the sessions#destroy method and current users presence are options for you, too.

@RobAWilkinson
Copy link
Member

True, but all the routing is done from the front end, right now user can see all links and pages, even when logged out.
Session.destroy will just make current_user nil, but won't redirect react-router or anything

@hpjaj
Copy link
Contributor Author

hpjaj commented Dec 10, 2018

Yeah, good call. I was thinking an option would be to check for the presence of the current user at either the controller or pages#index view level, but that would mean we'd have to redirect users to a rails view page, instead of our react login page, and that's no bueno.

@hpjaj
Copy link
Contributor Author

hpjaj commented Dec 17, 2018

@RobAWilkinson - Is this inline with what you're thinking?

https://youtu.be/ojYbcon588A

@RobAWilkinson
Copy link
Member

@hpjaj yes! Exactly, tyler mcginnis is gold

@hpjaj
Copy link
Contributor Author

hpjaj commented Dec 19, 2018

Sweet! I can take this one if you'd like?

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

No branches or pull requests

2 participants