Hello Vsevolod,
I'm not sure you'll be able to easily do it within microflows, you can do it in Java but most of the examples I've seen set up a handler so the java function gets a request and response which it can then use to redirect back to the index page.
Personally I'd suggest following conventions set by the Mendix app store modules. You can verify a user's password easy enough using the VerifyPassword java action in System, and if you use the AppCloudServices module as an example for your login java, you'll be able to find a SessionInitializer class within the appcouldservices java package which you can reuse or replicate.
Hope this helps
Have a look at the implementation of the Login Form Widget https://appstore.home.mendix.com/link/app/87/ .
Customize it by passing another microflow input which is called when the login button is triggered (the function _loginUser , check how the action for _forgotPassword microflow is handled).
If you want to dig even deeper, check the deployment folder deployment/web/js. Changing the file here does not do anything, because it will be overwritten when deploying it.