Login a user from a microflow

Currently I am building custom login logic so I can show a recaptcha if there have been more than three failed attempts. To do this, I do the login in a microflow where I have made a java action to login the user with: Core.login(user, password, getContext().getSession().getId().toString()); Sadly when running this, the user's screen stays stuck with a loader, even if I refresh the session object. Does anyone know what I need to add in my java to get the user redirected properly after the login action. Sadly there is nothing I can steal from the SAML module since I do not have a request.
1 answers

You could use the flow that the OAuth module uses for inspiration. And instead of showing a Mendix page still show the login page with the regular form. Use a request handler to catch that form post and then from that point forward you can use microflows called from the java request handler.

In the Oauth module you are redirected to your Oauth provider for authentication, and the callback comes back to another request handler that handles the result. Of course you could directly go to the callback and process the login request.