end-session-message
Reactive icon

Session Timeout Alert

Stable version 2.0.1 (Compatible with OutSystems 11)
Uploaded
 on 15 November 2024
 by 
5.0
 (4 ratings)
end-session-message

Session Timeout Alert

Documentation
2.0.0

New Modules:

  1. SessionTimeoutAlert_Lib:

    • SessionTimeout_Start: Main component responsible for session management, intercepting backend calls and controlling session variables.

      • Input Parameters:
        • TimeoutInSeconds: Total session timeout duration in seconds.
        • ShowPopupInSeconds: Time in seconds before the popup is shown.
        • isDebug: Boolean flag to enable or disable debug mode.
        • CallbackTimeRemainingInRealtime: Boolean flag to trigger a real-time event every second.
        • PopupTitle: Customizable title text for the popup.
        • PopupButtonKeep: Text for the "Keep Session" button.
        • PopupButtonCancel: Text for the "End Session" button.
        • ExtendedClass: Add custom style classes for the UI elements.

      • Events:
        • CallbackSessionLogout: Triggered when the user clicks the "End Session" button.
        • CallbackSessionTimeout: Triggered when the session time expires, but the popup remains active.
        • CallbackTimeRemaining: Triggered every second to update the remaining session time.

    • SessionTimeout_Callback: Listener component that listens for events from SessionTimeout_Start and triggers the corresponding events.

      • Input Parameters:
        • isDebug: Boolean flag to enable or disable debug mode.

      • Events:
        • CallbackEvent: Triggered when the popup message is shown or when a timeout occurs.
        • CallbackTimeRemaining: Triggered every second to update the remaining session time.

  2. SessionTimeoutAlert_Pat:

    • SessionTimeRemaining_Clock: Displays the session time remaining in a time format (mm:ss), listening for messages from the SessionTimeout_Callback.

      • Input Parameters:
        • isDebug: Boolean flag to enable or disable debug mode.

      • Events:
        • CallbackEvent: Triggered when the popup message is shown or when a timeout occurs.
        • CallbackTimeRemaining: Triggered every second to update the remaining session time.

    • Session_UserInfo: Displays the current user’s photo with a circular progress indicator, counting down the session time.

      • Input Parameters:
        • isDebug: Boolean flag to enable or disable debug mode.
        • UserPhoto: URL of the user's photo.
        • Username: Username to be displayed.

      • Events:
        • CallbackEvent: Triggered when the popup message is shown or when a timeout occurs.
        • CallbackTimeRemaining: Triggered every second to update the remaining session time.

1.0.1

Installation Instructions for the Session Timeout Alert Component

To use the Session Timeout Alert Component, follow these steps:

  1. Add Reference in Service Studio:

    • Open Service Studio.
    • In the navigation menu, go to the "Dependencies" tab.
    • Click on "Add Dependency" and search for the "Session Timeout Alert" component.
    • Add the component to your module.
  2. Incorporate into the Template Layout:

    • It is recommended to use the plugin in a layout block of the theme template that you use for building authenticated screens.
    • This way, all screens based on this template will have an event listening for XHR calls on the client side, managing session timeouts.

  3. Configure Events:

    • The component invokes four main events that should be configured:

      1. SessionLogoutEvent:

        • Triggered when the user clicks the "Cancel" button on the popup message.
        • This event should be used by the developer to end the session on the server side and redirect the user to the login screen.
      2. SessionRenewedEvent:

        • Triggered when the user clicks the "Keep Session" button.
        • If necessary, you can force navigation to a home page or another page.
      3. SessionTimeoutEvent:

        • Triggered when the session time has expired and the popup message remains, but only the "End Session" button is displayed.
      4. TimeRemainingEvent:

        • This event is triggered under different conditions:
          • When the CallbackTimeRemainingInRealtime parameter is TRUE, this event will be triggered continuously, second by second, decrementing the timeout and returning a TimeRemaining variable.
          • When the parameter is FALSE, this event will be triggered only in the final seconds, when the popup is displayed.

Input Parameters

The component has seven input parameters that can be configured according to your needs:

  1. TimeoutInSeconds:

    • Enter the timeout in seconds.
    • If the ShowPopupInSeconds variable is not provided, the pop-up warning will be triggered at 20% of the total timeout duration. 
    • For timeouts shorter than 60 seconds, the warning will appear halfway through the timeout period unless the ShowPopupInSeconds value is specified.

  2. ShowPopupInSeconds:
    • Determines the number of seconds before the pop-up warning is triggered.
    • It must be at least 5 seconds less than the TimeoutInSeconds value.
    • If not provided, the default behavior will trigger the warning at 20% of the total timeout duration for timeouts longer than 60 seconds, or at half the timeout period for durations shorter than 60 seconds.

  3. isDebug:

    • Useful for design-time debugging.
    • When TRUE, the plugin will log into console.log() with some steps of the process.

  4. CallbackTimeRemainingInRealtime:

    • This parameter influences the TimeRemainingEvent.
    • When TRUE, the "TimeRemaining" event will be triggered continuously during the current session, which may cause performance issues.
    • When FALSE, the "TimeRemaining" event will only be triggered in the final seconds, when the alert popup is displayed.

  5. PopupTitle:

    • Text for the popup title.

  6. PopupButtonKeep:

    • Text to customize the "Keep Session" button.
  7. PopupButtonCancel:

    • Text to customize the "Cancel" (end session) button.

  8. ExtendedClass:

    • Add custom style classes to the pattern.
    • Define your custom style classes in your application using CSS.

Note: This component is intended to improve the user experience by providing session expiration alerts. It should not be considered a security feature. Robust and sophisticated session control should be implemented server-side to ensure comprehensive application security.


1.0.0

Installation Instructions for the Session Timeout Alert Component

To use the Session Timeout Alert Component, follow these steps:

  1. Add Reference in Service Studio:

    • Open Service Studio.
    • In the navigation menu, go to the "Dependencies" tab.
    • Click on "Add Dependency" and search for the "Session Timeout Alert" component.
    • Add the component to your module.
  2. Incorporate into the Template Layout:

    • It is recommended to use the plugin in a layout block of the theme template that you use for building authenticated screens.
    • This way, all screens based on this template will have an event listening for XHR calls on the client side, managing session timeouts.

  3. Configure Events:

    • The component invokes four main events that should be configured:

      1. SessionLogoutEvent:

        • Triggered when the user clicks the "Cancel" button on the popup message.
        • This event should be used by the developer to end the session on the server side and redirect the user to the login screen.
      2. SessionRenewedEvent:

        • Triggered when the user clicks the "Keep Session" button.
        • If necessary, you can force navigation to a home page or another page.
      3. SessionTimeoutEvent:

        • Triggered when the session time has expired and the popup message remains, but only the "End Session" button is displayed.
      4. TimeRemainingEvent:

        • This event is triggered under different conditions:
          • When the CallbackTimeRemainingInRealtime parameter is TRUE, this event will be triggered continuously, second by second, decrementing the timeout and returning a TimeRemaining variable.
          • When the parameter is FALSE, this event will be triggered only in the final seconds, when the popup is displayed.

Input Parameters

The component has seven input parameters that can be configured according to your needs:

  1. TimeoutInSeconds:

    • Enter the timeout in seconds.
    • The pop-up warning will appear 60 seconds before timing out.
    • If you enter a timeout of less than 60 seconds, the component will consider 50% of it to show the popup.
  2. isDebug:

    • Useful for design-time debugging.
    • When TRUE, the plugin will log into console.log() with some steps of the process.
  3. CallbackTimeRemainingInRealtime:

    • This parameter influences the TimeRemainingEvent.
    • When TRUE, the "TimeRemaining" event will be triggered continuously during the current session, which may cause performance issues.
    • When FALSE, the "TimeRemaining" event will only be triggered in the final seconds, when the alert popup is displayed.
  4. PopupTitle:

    • Text for the popup title.
  5. PopupButtonKeep:

    • Text to customize the "Keep Session" button.
  6. PopupButtonCancel:

    • Text to customize the "Cancel" (end session) button.
  7. ExtendedClass:

    • Add custom style classes to the pattern.
    • Define your custom style classes in your application using CSS.

Note: This component is intended to improve the user experience by providing session expiration alerts. It should not be considered a security feature. Robust and sophisticated session control should be implemented server-side to ensure comprehensive application security.