How to create popup warning the user before the Session Expires

How to create popup warning the user before the Session Expires

  

I have not been able to find a solution to this question.  How do can a person create a popup that warns the user that their session will be expiring in 2 minutes.  I'm guessing this will involve some javascript and some type of call to the serve to refresh the session if the user clicks to continue.  


Thanks!

You are right.

You have to have some javascript-polling mechanism


Roughly the idea is to poll with a ajax-request to a page that keeps the time of the user.

mind you that will take some effor of keep the time right, because the session is a sliding-session of course


Actually the polling mecanism might not work properly because it's ajax request will automatically refresh the user's session, so it won't never expire.

Take a look at this component I just built. It might help you.
https://www.outsystems.com/forge/Component_Overview.aspx?ProjectId=1880&FromSave=True

Joao, are you able to provide a version of your component that I can open in OutSystems version 9?  I tried opening it and it said it was saved using version 10 which we are not currently using yet.


Thanks

Unfortunately I don't have access to a v9 environment right now.

You can install the component in your personal environment and try to mimic it's behaviour in a new component at you environment. It's just a piece of javascript and CSS, and a container.



christopher bennett wrote:

Joao, are you able to provide a version of your component that I can open in OutSystems version 9?  I tried opening it and it said it was saved using version 10 which we are not currently using yet.


Thanks



I think this will help. Thank you for the assistance!


Hi Joao Melo,

I am working on something similar to your component. My application session timeout period is 20 mins (default value). After this period when the user clicks any option in the application, he is redirected to the login page. The requirement is that after session timeout and when the user clicks any option, a popup should appear displaying that the user has been logged out and should click on the provided link to login again. 

Your component has a web block and javascript code to achieve similar kind of task. Could you please guide me on how the web block can be used or where this can be called taking my scenario into consideration ?

Thanks.


João Melo wrote:

Actually the polling mecanism might not work properly because it's ajax request will automatically refresh the user's session, so it won't never expire.

Take a look at this component I just built. It might help you.
https://www.outsystems.com/forge/Component_Overview.aspx?ProjectId=1880&FromSave=True



Solution

Hi Kerrthana. It's pretty easy.

Just put the "SessionExpiration" webblock in your Footer webblock, and pass 1200 as parameter for your timeout in seconds (20 minutes).

You can see the demo app in the Try Now button. In the demo page there is a link to download itself.

Solution


Thank you :) It did work fine. 

João Melo wrote:

Hi Kerrthana. It's pretty easy.

Just put the "SessionExpiration" webblock in your Footer webblock, and pass 1200 as parameter for your timeout in seconds (20 minutes).

You can see the demo app in the Try Now button. In the demo page there is a link to download itself.