Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

morning how do i block the page for the user using login form not to access data and unlblock after enter details

morning how do i block the page for the user using login form not to access data and unlblock after entering their details

1 Answer

Hi kevin,

Your question is a bit broad, as there are likely several factors that will determine how you would code this.

I'm assuming what that what you want to do is bring up a login form when a user navigates to a certain page on your site, and then when they've entered in their details, you would allow them to see the page they were looking for. But again, the question is a bit broad, so I'm only guessing.

If my assumption is correct, then one way of achieving what you're going for (and this is very bare bones, as the following steps would be broken down into smaller steps) is to check if your user is logged in, and if they are, you will render the page they navigated to. If the user is not logged in, then you would redirect them to the login page.