Logging out a user using a button (flow.java)

I have a functionality that requires users to change there password after a given amount of days. After login they'll get a blocking pop up for changing there password. They have to change the password because they will not be able to use the application if they do not change the password (blocking pop up). The pop up got a save button to confirm the changed password. I also want a cancel button that will bring the user back to the login screen. The cancel button will trigger a microflow with a java action in it. The following code is stated in the java action: Core.logout(getContext().getSession()); but when i press the cancel button the first time nothing happens. But when I press the cancel button for the second time, the user is logged out. Why does this java action needs to be triggered two times before the user is logged out? How can I fix this? It looks like the user is logged out when pressing the cancel button for the first time, but the client isn't refreshed. The client refreshes after pressing it the second time. I tried the following actions after the java action which logs the user out: Refresh of an object in a flow. Refresh of an object in java refresh of a class in java Change an object commit and refresh it in a flow I have no clue how to let this work
2 answers

Disclaimer: this might not work in a future version, and I recommend against this kind of workarounds

A quick work around for the refresh: After destroying the users sessions, you could open a new form with a URL redirector (available in the appstore) and redirect to your login page.

update: another solution might be

put a HTML Snippet in your form with the following contents:

<button value="Cancel" onclick="javascript:dojo.cookie('XASSESSIONID', null, {expires: -1});window.location.reload();"/>

This will remove the flash, but you need to style the button, and pressing the 'X' in the popup will still cancel the whole process.


It works with the url redirector. But I'm sure our customer will be not satisfied about the pop up which is loaded for less then a second. But our customer has to be satisfied with it, because there is no other option.