Logout

Hello I have an interesting phenomenon. When I create the logout it works in IE, Firefox and Chrome. I am logged out of the dashboard and i go to the login page. If I open the dashboard without logging in, I always end up on the login page, except for Firefox, there I stay on the dashboard page without logging in an The session is not deleted. Why??

Hmm, sounds like a Firefox issue. Have you googled Firefox not deleting sessions?

Is by any chance your Logout text/button wrapped in a link?

I had the same issue a few months back with Firefox where I had a Logout text link as a list element. I had to remove the <a> tag and use dmx-on:click= instead to load the logout server action.

Might be unrelated to your issue.

Probably you just didn't have any href attribute added, or it was empty. This makes the page reload.
<a> tag works fine with the logout action, and the dynamic onclick event is the right action for this.

1 Like

So originally I had something like:

<a href="/login">
    <li dmx-on:click="logout.load()">Logout</li>
</a>

Tested and worked fine on Chrome, Safari, IE, Edge but just wouldn’t work on Firefox. It would fire the logout server action but just wouldn’t redirect in Firefox so in the end settled for:

<li dmx-on:click="logout.load();browser1.goto('login')">Logout</li>

Which is probably the recommended method anyway.

Well, why would you nest a <li> inside an <a>, which points to another page? It will never work properly, as when you click the <a> you will be redirected to the /login page and you can never be sure the onclick event will run before that.

dmx-on:click="logout.load();browser1.goto('login')"

this is also not a good idea, as you can never be sure the logout is finished, before running the goto action.

The best solution is either using an <a> or a <button> which only triggers the logout server action:

<a href="javascript:void(0)" dmx-on:click="logout.load();"> Logout <a>

or

<button dmx-on:click="logout.load();"> Logout </button>

And then you run the goto action on dynamic event > success of the logout action. You should never list actions like: logout.load();browser1.goto('login') if they require the first one to finish, and then run the second one.

1 Like

You are perfectly correct, sometimes it’s the simplest of actions that get overlooked.

Wooow as well as it works :+1: