Logout a user if login in another browser

Hi,

what is the best way to logout a user that is logging in from another browser / device ?

The procedure should be:

  1. Store the session of logged in users
  2. at login, check if the user is already logged
  3. if it is the case invalidate the session, show the login page and show an alert message.

what i’m having problem is on showing the alert message on the session user that has been invalidated.

this is my code

[code]
VaadinSession refVaadinSession = userSessionInfo.get(cRef);

                        refVaadinSession.getUIs().forEach(ui -> {
                            if (ui.getPage() != null) {
                                
                                Notification notification = new Notification(getI18n("user_logged_in_another_location").replace(":user", getAdo2kUser().getUsername()), Notification.Type.WARNING_MESSAGE);
                                notification.setDelayMsec(-1);
                                notification.show(ui.getPage());
                                ui.push();
                                
                                ui.getPage().reload();
                                ui.push();
                                
                                refVaadinSession.close();
                            }
                        });

                        userSessionInfo.remove(cRef);

[/code]any ideas?

Thanks