Remember Me not allowing log out

Hi all,

PHP development.

If a user clicks remember me when logging in the logout function will not work, it will not kill the cookie. The logout function works fine if the remember me box has not been ticked.

I have a feeling that this is going to be something really sill. Any help appreciated?

How have you set up the log out function?

Not sure if this info helps?

It's not very clear what you are doing with the button here.
Please paste the button code here.

Logout

As I say it works fine when the Remember Me button is not selected at login.

The run steps in the flow don't wait for the previous one to complete, they run at the same time. This means the redirect step can run before the step that runs the server action.
To fix this you need to run the logout server action and then run the redirect event after it's finished.
Which means - remove the flow from the button. Add a click dynamic event and call the server action directly on click (without a flow).
Then select the logout server action, add a dynamic event > success > and call the browser redirect there.

Thanks, I have done that, but it still doesn’t solve my main problem in that I can’t action the logout if the remember me box has been ticked.

To be honest I am getting some very erratic behaviour. Think I will have to completely delete all my security stuff and start again.

Are you sure both login and logout actions use the same security provider?
Please provide a link where i can see what’s happening.

Yes, I only have the one security provider. As I say it logs out ok if I have not clicked the remember me box.

I have already started to dismantle so cannot provide a link.

What the remember me option does is to set a cookie.
If you don't use the remember me option, the login does not create a cookie and is valid only for the session.

Thanks I appreciate that but it misses the point that if I login without ticking the remember me box I can log out fine. But the logout process fails if I log in and do tick the remember me box. The logout function is not clearing the remember me cookie.

You must be doing something wrong, as it works just fine in my tests.
Can you verify in the dev tools under network > XHR that the logout action actually runs and returns status 200, when you click the button?
Also how exactly do you verify if you are logged in or not?

I am sure that I am doing something wrong. So I am starting again and no matter how many times I delete the Security Provider it keeps coming back when I restart Wappler and I have checked that the file doesn’t exist on the server or locally. :frowning: