karthik stj
karthik stj

Reputation: 57

session timeout for inactive users in SAP ui5 application

I am creating an UI5 application.My question is how to set session timeout for inactive users.Is there any direct property for session time out?

Upvotes: 0

Views: 4910

Answers (1)

Sunil Dabburi
Sunil Dabburi

Reputation: 1472

You can handle this using setTimeout and clearTimeout functions. Whenever the user does mouse move or key press, reset the timer using clearTimeout function and setTimeout again for the threshold limit.

Ex:

document.onmousemove = reset;
document.onkeypress = reset;

function reset() {
    clearTimeout(threshold);
    setTimeout(sessionTimeout, <interval>); // interval is in ms
}

If the user does not use the page at all for given interval, it automatically times out. I just gave you a use case, You can handle it based on your need. Hope this brief information helps you.

Upvotes: 1

Related Questions