LogicMachine Forum
Auto Logout - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Auto Logout (/showthread.php?tid=2396)



Auto Logout - marc - 19.12.2019

Hi Everybody,

I have a SL-Project with about twenty users. Six of these must be logged out after 90 seconds, the rest must remain logged in.

How do I have to modify the following script?
Code:
$(function() {     // Back to Start after x seconds (in miliseconds)   var SE_Timeout = 90000; // adjust this timer value if needed (90 seconds in miliseconds)   var SE_Startpage = currentPlanId; // First page that is loaded   var eventlist = 'vclick vmousedown vmouseout touchend';     // Timer function no usage detected   function No_Usage_Detected(callback, timeout, _this) {     var timer;     return function(e) {         var _that = this;         if (timer)             clearTimeout(timer);         timer = setTimeout(function() {             callback.call(_this || _that, e);         }, timeout);     }   }   // Back to start function when timer elapsed     var SE_Goto_Startpage = No_Usage_Detected(function(e) {     if ( currentPlanId != SE_Startpage ) {     showPlan(SE_Startpage);     $(location).attr("href", "/logout");     }   }, SE_Timeout);     // Add event listener to document to detect user input   $(document)   .on(eventlist, function() {     SE_Goto_Startpage();   });   // Add event listener to all iframes to detect user input inside iframes   $('iframe').load(function() {     var iframe = $('iframe').contents().find('html');     iframe.on(eventlist, function(event) {      SE_Goto_Startpage();     });   }); });