Can I modify the logout behaviour of the app?

We're currently using the action that's detailed in this forum post: When the customer logs out they are redirected to the login.html page in the theme folder of the app. We want to change the behaviour so that logging out will redirect the customer to different pages depending on what page they are currently viewing; can anyone tell me how to modify the java action or take a different approach to achieve this?
3 answers

Hi Mark, 
One possible way you could do this is build a request handler on something like /logout. The /logout request handler would first log the user out using the code that i provided and then would respond in the html response by directing the user to the logged out page. 

So in Mendix you would use a link button that would point to ./logout. To make sure that they are directed to the correct html page you could include some get parameters for example ./logout?page=logoutpage1.html. 


If your pages are in Mendix and not html you need to Log the user out using a java action inside a microflow then open a page in the microflow. However this probably won't work because you will need to get a new session for anonymous users. So you should probably redirect the user using a redirect page and a deeplink. You could make the redirect dynamic based on an attribute from a object.


There is multiple options depending on what you are trying to achieve, whether the page is hosted in Mendix or external.




I think you best bet is to use the URL redirector widget from the AppStore. Perhaps you will need to combine this with some JavaScript which captures the current page and passes that to a microflow (unless you have a very limited number of pages to redirect to, in which case you could create a separate microflow for each page to which a user should be redirected).


Create custom logout button? Use the logout java action, introduce anonymous users and create pages where you want them to go