Wednesday, 17 July 2019

How to restrict access to pages for users not logged in?

I am a beginner in NodeJS and I am building a website where I want to restrict access to pages for unauthorized users. I am using express-session to achieve this. The part where I am stuck is this:I Log in to the app. Logging in takes me to the dashboard page. I am using req.session to give access.I logged out of the app. Then when I type in the address bar: http://localhost:5000/dashboard, it leads me to the error page. This is actually fine, because the session variable is destroyed when I logout. But when I type http://localhost:5000/dashboard.html, it takes me to the dashboard page.How can I solve this error?

Submitted July 17, 2019 at 05:02PM by sainatarajan7

No comments:

Post a Comment