Simulate a logged in user in build mode

My entire project is made of pages restricted to logged in users only. In header there is the name of the user. Many sections are shown / hidden based on logged in user conditions. But I can’t find a way to simulate in Wappler the logged in user.

I tried to cancel the security provider enforced in the page. Also I tried to preview the login page in Wappler and log in from inside the tool. In this case I can see the data of the logged in user in the destination page (redirect from login), but I am still on the login page. No way to edit.

Any idea how to simulate the logged in user in build mode ? Thanks

Yes, in live mode
image

open your login page or a restricted page (which should then redirect to login)

You then simply need to login via your login page within Wappler and that will do what you want

Thanks, @Hyperbytes. But I am probably making some mistake since this is my situation.

Login in preview mode

Correct redirect to the onboarding page, but still in login.php

Refreshed the onboarding.php but no user name and conditional section

You need to login via live mode, not preview mode.

Do you mind telling me how to login in live mode ? I have tried bu the username and pwd fields can not be filled via keyboard. Maybe it’s easy … but I can’t do it :blush:

Hi @Teodor, I send this topic to your attention. Maybe you can help me. Thanks

Just click the lightning bolt icon at the top right of the page

There is already a thread on this

Maybe I see where is the problem. A login form is needed in each and every page in order to be able to simulate a logged in user in live mode.

In my case I have just one login.php page that redirects to one specific page (onboarding.php). On all the other “internal” user page, there is only the logout button that redirects to the login.php. In this scenario I will never be able to simulate a logged user in one of those pages, just because on log out => go to login.php and on login => go to onboarding.php

Can you please confirm that my understanding is correct and that I need to insert a login / logout function on each page ? Many thanks

You need the security enforcer on each page. One login page is needed per site…
There is no issue to browse between the pages in live mode.

If you have set up the security enforcer properly in app connect then you can divert non logged in users to the login page automatically. Once logged in the security enforcer will not divert to the login page

image

Thank you. At the end I think I got it :slight_smile:

Inside Wappler I preview any page under security enforced, given that a logout button exist somewhere in the page. Click the logout button in preview mode and go to the login page. Then login as a registered user and I am apparently redirected to the onboarding page. But I just need to refresh the preview and I am back in the original page. Then click on live mode and I can see all the component for that specific user.

Thank you for your time @Hyperbytes @Teodor

1 Like