Logout the pgAdmin session when no user activity of mouse move, click or keypress. Fixes #5000.

Introduced two config params:
1. USER_INACTIVITY_TIMEOUT - Interval in seconds for the timeout. Default is 0-Zero which means disabled.
2. OVERRIDE_USER_INACTIVITY_TIMEOUT - If set to true, tools like query tool or debugger will override USER_INACTIVITY_TIMEOUT
   and will not allow the application to timeout if a query is running for a long time.
This commit is contained in:
Aditya Toshniwal
2020-01-15 18:07:46 +05:30
committed by Akshay Joshi
parent d59816054f
commit 8c3bba65e5
12 changed files with 346 additions and 3 deletions

View File

@@ -1891,6 +1891,14 @@ define([
pgWindow.default.pgAdmin.Browser.onPreferencesChange('debugger', function() {
self.reflectPreferences();
});
/* Register to log the activity */
pgBrowser.register_to_activity_listener(document, ()=>{
Alertify.alert(gettext('Timeout'), gettext('Your session has timed out due to inactivity. Kindly close the window and login again.'));
});
controller.poll_result = pgBrowser.override_activity_event_decorator(controller.poll_result).bind(controller);
controller.poll_end_execution_result = pgBrowser.override_activity_event_decorator(controller.poll_end_execution_result).bind(controller);
},
reflectPreferences: function() {
let self = this,