After the login there is an if statement for included files from the modules:
It could be that in one of those files there is a redirect to another place, and in this case the user does not get to the MFA process. The MFA process must be placed before the filesToInclude function.