Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 2 weeks ago
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
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);
any ideas?
Thanks
Last updated on
You cannot reply to this thread.