How to prevent multiple windows from opening on the same browser

In Cuba, I extend the AppUI to check if there is an existing UI and if the user has logged in and kill it. The purpose is to prevent multiple instances of the same application on the same browser, as a security requirements by banks.

How do I do the same thing in Jmix 2.x ?

Hi!

You can try the following code to find all UI instances of the application:

VaadinSession.getCurrent().getUIs();

Returned UI instances have a ‘UIid’ attribute, which is incremented upon each instance creation.
When opening a view, you can process the returned list of UI instances and destroy unnecessary sessions.

Best regards,
Dmitriy