Good afternoon all. We are working on our first reactive web application, and one of the requirements is to warn idle users that they will be logged out in 5 minutes and then again when they will be logged out in 1 minute. From what I've seen the MAX_IDLE_TIME will handle the actual logout functionality but I have not been able to find a way to implement the warnings. Any suggestions?
Also, just for my understanding. If a user is on a particular screen and they reach the MAX_IDLE_TIME they will not automatically be redirected to the Login screen. That will not occur until the next time the user attempts to fetch data from the server, is this accurate?
Hi,
you can look here:
https://success.outsystems.com/Documentation/11/Managing_the_Applications_Lifecycle/Secure_the_Applications/Configure_App_Authentication
There is good information in that link, but I see nothing about popping a warning message when session expiration is imminent.
Did you find a solution to this?
No, I didn't. I ended up creating a web block with some javascript that sets an interval and then warns the user that timeout is approaching or calls a client action that signs them out when it has expired.
Cheers for the response! I was looking at a similar issue and was hoping maybe you had found something. I may look to do the same then.
Here is the JavaScript, I just call it onReady of the web block. The only issue I've noticed is that if the user does not have the tab active, the interval is still running in the browser but all of the events are essentially queued and executed when the tab/window regains focus. So that's a little weird, if you find a better solution please let me know.
function idleTimeout (uTimeout, uWarning,uTimeoutAction,uWarningAction) {
var interval = 60000;
var IDLE_TIMEOUT = uTimeout;
var IDLE_WARNING = uTimeout - uWarning;
var idleCounter = 0;
var warningAction = uWarningAction;
var timeoutAction = uTimeoutAction;
var timeoutInterval;
document.onmousemove = document.onkeypress = function () {
idleCounter = 0;
};
timeoutInterval= window.setInterval(CheckIdleTime, interval);
console.log("Created Interval:");
function CheckIdleTime(){
if (++idleCounter >= IDLE_TIMEOUT) {
console.log('Triggering session timeout ');
timeoutAction();
clearInterval(timeoutInterval);
} else if (idleCounter == IDLE_WARNING) {
console.log('Triggering session warning ');
warningAction();
}
return timeoutInterval;
Thanks so much for this. I think we are looking to go with changing the outsystems timeout to match sso and maybe putting in a check role or something in an onrender function to trigger an authentication session. I'm not sure if that will help with your case but thought I'd let you know.
Hello, I am not quite following what you have done. So in OnReady you call JavaScript function and put in the code you specified.
However, I am missing the piece where you call the function (idletimeout) you just created and an example of what you pass into the function. Do you mind sharing more on this solution?
What would you pass into the actions?
It's not perfect, but we created an application that contains a public block. The block has a required script which defines the idleTimeout function. Then onReady call the IdleTimeout and define the intervalName.
OnDestroy we clear the interval and in the Trigger Session Timeout/Warning we raise events that the consuming pages must handle.
Thanks!!