User does not get logged out

Wappler Version : all versions
Operating System : Windows 10
Server Model: NodeJS
Database Type: MariaDB
Hosting Type: Custom

Expected behavior

When no user has logged in or a logged in user has been logged out, I expect to see
image

Actual behavior

When a logged in user is logged out, I see
image
and
image

This is probably another of my senior moments. In the past, I have kept track of logged in/out users using a session variable. But surely I should be able to use identity to perform the task.

image

It (identity) works great when a user logs in.

Have you tried using the security logout module this should completely remove the identity until next logged in

If this is what you are referring to

image
then the answer is yes.

If this using a session variable on this project or old projects you have? I normally just use the identity module and nothing to do with sessions

For this project I am not using a session variable, I am using identity.

I’ll leave this one to the more experienced members for me using security logout seems to be working not sure what could be different here.

I should add that I am not sending the user to a login page or similar. The user stays on the same page. However, when I refresh the page after logout, all is well.

I don’t see why the page should be refreshed or go to another page for the identity to function properly.

Hi Ben,
The steps added in the Globals are executed before the server actions steps.
In your case, the Identity value is displayed, then the logout action runs. That’s why you still the identity, on page refresh it will clear as the user already logged out.

You can add the identity step in the logout server action also, just after the logout step, this should clear the identity.

Thanks Teodor. Unfortunately, this also does not work. I’ll give it a few more tries for alternatives.

@Sorry_Duh, sorry (pun intended :rofl:), forgot to say that I appreciate your input. Much indebted.

1 Like

Can you show a screenshot of your logout server action steps please?

Can you send me a link to your page where i can check this?

This is still a work in progress, so please excuse any faults
https://bunchokids.org/

You can first register and then log in/out as you wish.

I can’t register as there are some db user permission issues:

code: "ER_ACCESS_DENIED_ERROR"
message: "ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: NO)"

do you have a test user which i can just use to log in and log out?

Sorry, try it now

UN: bok@pleysier.com.au
PW: Tester123#

I see that you have dmx-on:click="scLogout.load(true);scCustomerDetail.load()"> - that’s not how it should be done.
You should not load the customer details server action there. It should only be loaded on success of logout action.

And also the logout action properly shows empty identity:

Ah! Right, will fix that with a form. Thank you. I’ll shout you a crate (if) when it works.

You don’t need a form :slight_smile:
Run the logout server action on click. Then for the logout server action add dynamic event > success > and run the user details server action there.

Local server works fine.

Remote error
image