Requiring login? (SOLVED)

How can I require login on

a) a particular page?
b) all pages?

Currently I am implementing the latter using a workflow on my reusable header component - when the page is loaded, it navigates to a “login required” page.

However this has the pretty fundamental flaw that briefly - before you are redirected - you can see a flash of all the content on the page.

Is there some better way to do it that means the page is never loaded?

2 Likes

a) Can do the same as for (b) below or you can place all elements in a container and make it not visible.

b) I do this on workflow on all my pages that requires login

6 Likes

Thanks for the help. Quite tedious for each page to have to have that group control, but it will work.

Instead of waiting for when the page is loaded as used in the workflow above, I’ve done the following:

  • Choose General > Do when condition is true
  • For action, choose Navigation > Go to page…
  • Finally, just select the destination of the page you want to redirect to (ex: index)

@mmcconna Just a side-note, instead of changing the title to “SOLVED”, you can just click the solved button at the bottom of the post that solved your question which you can reveal with the “…” icon, like below. This way, it shows the most helpful post at the top of this thread.

4 Likes

Thanks. Can you post the condition you are using too?

Condition? What do you mean?

Both of the above answers will wait for the page to load to trigger the redirect. The correct way to do this is triggering an event off GeneralUser is logged out.

5 Likes

@joel.milne, can you please give us more details, please? What do you mean? I can’t understand this sentence.

@vovahumnytskiy
When you trigger an action after a page load event you are currently waiting for the ready response from the website.

The correct way as @joel.milne said, is just to check if the user is logged before the page starts loading.

So just add the workflow in this way:

Instead of this:

Redu.

4 Likes

gyt, thanks a lot! That is exactly what I need.

Very important from a security point of view. Until now I had only seen recommendation based on “Page is loaded”, which isn’t as secure as this one based on “User is logged out” because it doesn’t wait any page part to be loaded.

I tried all these methods. Unfortunately, first the page is loaded and then directed to login page.

i am facing the same issue!