I am using pas.plugins.tfa in Plone 6.0.15 using ClassicUI.
Using the login in a modal/pop-up, the plugin returns an error after the login form succeeds so that the verify form is rendered in the same modal form. This is because the modal by default is set to render the response within the modal if an error message is in the response. This is not ideal because there is no actual error. As a workaround, what I have implemented is:
Change the error message type to warning:
api.portal.show_message("Two-factor authentication is enabled, you need to enter your generated passcode", request, type="warning")
Then in ZMI>portal_actions>user>login>modal:
{"prependContent": ".portalMessage", "title": "Portal Login", "width": "26em","actionOptions": {"redirectOnResponse": true, "error": ".portalMessage.error, .alert-danger, .alert-warning"}}
Here I overrode the "error" option and added ".alert-warning" to the default so that the warning messages are also rendered in the modal. I can not use an info message because after successful verification, Plone returns a success info message. The response is rendered in the modal which is no longer desired at this point.
I am satisfied with my workaround but I am interested to know how others have resolved the issue.
Thanks.