Wilton Ergon Posted February 11, 2021 Share Posted February 11, 2021 there are dozens of topics on the forum talking about it, but none that I've tried works. my timeout is working properly, and ends application in 10 minutes of inactivity, I would just like to display a warning to the user when the inactivity timeout occurs. already tried to approach this link without success. in the script, I tried to change mainmodulo by frmprincipal (because it is the name of my main form. when the time limit is reached, when the user clicks on something, he goes back to login, the user thinks that the connection has fallen due to system failure. and I need to warn him that it is due to the time he spent without using the system. I also tried to use the mainmodule sessiontimeout event, but it is not fired. procedure TUniMainModule.UniGUIMainModuleSessionTimeout(ASession: TObject; var ExtendTimeOut: Integer); begin showmessage('Tempo expirado',nil); end; unigui 1.90.0.1526 sessiontimeout 600000 in servermodule hyperserver [node_recycling] enabled=1 recycle_after_secs=3600 recycle_after_sessions=0 recycle_after_idle_secs=700 recycle_when_empty=1 Quote Link to comment Share on other sites More sharing options...
Wilton Ergon Posted February 11, 2021 Author Share Posted February 11, 2021 var IDLE_TIMEOUT = 600; // 10 minuts var _idleSecondsCounter = 0; document.onclick = function() { _idleSecondsCounter = 0; }; document.onmousemove = function() { _idleSecondsCounter = 0; }; document.onkeypress = function() { _idleSecondsCounter = 0; }; window.setInterval(CheckIdleTime, 1000); function CheckIdleTime() { _idleSecondsCounter++; var oPanel = document.getElementById("SecondsUntilExpire"); if (oPanel) oPanel.innerHTML = (IDLE_TIMEOUT - _idleSecondsCounter) + ""; if (_idleSecondsCounter >= IDLE_TIMEOUT) { ajaxRequest(FrmPrincipal.form, '_idle_timeout', []); ///-> ***** } } **** I was not referring correctly to the form. putting the correct name, performed correctly. procedure TFrmPrincipal.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = '_idle_timeout' then begin uniGUIApplication.UniSession.Terminate('Sua conexão foi encerrada por inatividade de mais de 10 minutos'); end; end; this event does not fire at the login screen, I put the same code there too, but with just 1 minute (enough time for the user to enter the password), this prevents the system from being open on the login screen indefinitely 1 Quote Link to comment Share on other sites More sharing options...
Kattes Posted March 16, 2023 Share Posted March 16, 2023 Thank you Wilton for this inspiration! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.