Directory

← Back

Idle Notification

Displays a notification and action-buttons before session-timeout

Author

Rating

Popularity

300+

Idle Notification is an add-on that notifies the user before their session is about to expire. It enables the following features:

  • specify a message to be displayed to the user (which may include a count-down timer) before their session expires
  • set the number of seconds before session termination, at which point the notification is displayed.
  • add a button to the notification that enables the user to poke the server, thereby extending the session.
  • add a button to the notification that allow the user to immediately redirect to a different URL (e.g. a logout URL)
  • add a close button, allowing the user to close the notification without taking any action
  • specify a different message to be displayed to the user once their session has been terminated
  • determine whether an outside click when the notification is opened would extend the session
  • specify a URL to which the page would be automatically redirected upon session termination

Major pieces of development of this add-on has been sponsored by multiple customers of Vaadin. Read more about Expert on Demand at: Support and Pricing

Sample code

IdleNotification idleNotification = new IdleNotification();

// No. of secs before timeout, at which point the notification is displayed
idleNotification.setSecondsBeforeNotification(90);
idleNotification.setMessage("Your session will expire in " +  
    IdleNotification.MessageFormatting.SECS_TO_TIMEOUT  
    + " seconds.");
idleNotification.addExtendSessionButton("Extend session");
idleNotification.addRedirectButton("Logout now", "logout");
idleNotification.addCloseButton();
idleNotification.setExtendSessionOnOutsideClick(false);

UI.getCurrent().add(idleNotification);
IdleNotification idleNotification = new IdleNotification(90);
idleNotification.setRedirectAtTimeoutUrl("logout");

UI.getCurrent().add(idleNotification);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Added a formatter (IdleNotification.MessageFormatting) for minutes:seconds (mm:ss) to the timeout instead of plain seconds

Released
2024-08-21
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 14
Vaadin 23+ in 2.0.0
Browser
N/A

Idle Notification - Vaadin Add-on Directory

Displays a notification and action-buttons before session-timeout Idle Notification - Vaadin Add-on Directory
Idle Notification is an add-on that notifies the user before their session is about to expire. It enables the following features: - specify a message to be displayed to the user (which may include a count-down timer) before their session expires - set the number of seconds before session termination, at which point the notification is displayed. - add a button to the notification that enables the user to poke the server, thereby extending the session. - add a button to the notification that allow the user to immediately redirect to a different URL (e.g. a logout URL) - add a close button, allowing the user to close the notification without taking any action - specify a different message to be displayed to the user once their session has been terminated - determine whether an outside click when the notification is opened would extend the session - specify a URL to which the page would be automatically redirected upon session termination ### Sponsored development Major pieces of development of this add-on has been sponsored by multiple customers of Vaadin. Read more about Expert on Demand at: [Support](https://vaadin.com/support) and [Pricing](https://vaadin.com/pricing)
View on GitHub

Idle Notification version 1.0.0

Idle Notification version 1.1.0
Extends ThemableMixin, thereby allowing styling via Java API using @CssImport annotation

Idle Notification version 1.1.1
Event listeners: - Redirect - Close - ExtendSession - Open - TimedOut

Idle Notification version 1.1.2
Styling changes

Idle Notification version 1.1.3

Idle Notification version 1.1.4

Idle Notification version 1.1.5
Fixed a timer issue where a vaadin-dialog-overlay was added unnecessarily

Idle Notification version 1.1.6
Fix for _handleLoad not getting called at all and making the event listener removable

Idle Notification version 1.1.7
#### Bug fixes: * fix: do not reset timer on heartbeat requests

Idle Notification version 2.0.0
### Version 2.0.0 - Compatible with V23+, tested with 23.3.1

Idle Notification version 2.0.1
### Version 2.0.1 - Fix issue of modal Dialog blocking extend session event

Idle Notification version 1.1.8
#### Bug fixes: * remove unnecessary @NpmPackage declaration for Dialog component

Idle Notification version 1.1.9
Added a formatter (IdleNotification.MessageFormatting) for minutes:seconds (mm:ss) to the timeout instead of plain seconds

Online