How to hide a page if user is logged out?

Hey everyone,

Can someone provide insight on how I can hide entire pages if a user is logged out?

Thanks in advance!

1 Like

Hey there,

You can do that by using conditionals such as: ā€œCurrent user is logged inā€ → This element is visible

cheers

2 Likes

Placing the entire page in one hidden group, and placing a condition in the group: ā€˜when user is logged in’ → ā€˜this element is visible’.

This way the page is hidden by default, and you’re only dealing with a single element on the condition.

2 Likes

Both the above solutions are correct. To add to them, you can also navigate the logged-out user to a public page like your index or login page.

2 Likes

Okay awesome, thank you!~!

What would be the purpose of placing the page in a hidden group if the conditional would hide it by itself? Would this a a better practice method?

It’s probably my overly-careful personality :slight_smile: My thinking is I don’t know how quickly a ā€˜condition’ checks for something, so I try to avoid any split-second flashes of loading before a condition returns as ā€˜True/False’ to make it hidden again. Again, this may not be an issue but I do this just in case it is…

1 Like

I think I’m following, thank you for your input! This sounds like it will be the best was since it will shortcut any lag time. Thank you for your expertise!

1 Like

If a user has closed the session the correct way is to not allow access to that page if he is not logged into the system.

You can do this with a ā€œPage is loadā€ event.

Inside the event you add a ā€œGo To Pageā€ action and choose where you want to direct the user.

To the event you need to add a condition ā€œCurrent user is logged outā€.

So that it only executes the event when the user is not logged in.

This way, the user will not have access to the page.

If you put the content of the page inside an element and hide it, this is not a safe thing to do because if the person has experience reading code he can find information of the hidden group inside the HTML code or even if he would use the debugger mode inspector he could find the hidden group.

1 Like

That makes complete sense, thank you!