iX Talk
http://beijerinc.com/support/ix/forum/

Security: Auto log out: Inactivity Period
http://beijerinc.com/support/ix/forum/viewtopic.php?f=4&t=2171
Page 1 of 1

Author:  kkwon2 [ Mon Feb 20, 2017 12:22 pm ]
Post subject:  Security: Auto log out: Inactivity Period

Can the auto logout inactivity period be changed at runtime?

Author:  Lars [ Wed Feb 22, 2017 3:58 am ]
Post subject:  Re: Security: Auto log out: Inactivity Period

As fas as I know its not possible. But here's a small example how you can do your own log out function with your own tag for seconds before auto logout.
It uses the mouse position, and that works even if you dont have a mouse attached.

private static System.Windows.Forms.Timer _timer;
private int _mouseX = -1;
private int _mouseY = -1;
private int _mouseMoved;

private void TimerTick(Object sender, EventArgs e)
{
var x = System.Windows.Forms.Control.MousePosition.X;
var y = System.Windows.Forms.Control.MousePosition.Y;

if( ( Math.Abs(_mouseX-x) > 5 ) || ( Math.Abs(_mouseY-y) > 5 ) )
{
_mouseMoved=0;
}
else
{
_mouseMoved++;

var inactivityTimeout = Globals.Tags.System_InactivityTimeBeforeLogout.Value * 60;

if((inactivityTimeout>0) && (_mouseMoved > inactivityTimeout))
{
Globals.Security.Logout();
}
}
_mouseX = x;
_mouseY = y;
}

void Scriptmodule_Created(System.Object sender, System.EventArgs e)
{
// Set up timer that monitors if the mouse has moved
_timer = new System.Windows.Forms.Timer {Interval = 1000};
_timer.Tick += TimerTick;
_timer.Enabled = true;
}

Good luck :)

Page 1 of 1 All times are UTC - 7 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/