Log out idle user after a certain period of time
Description
This extension will allow to automatically log out users after a certain period of time that they have been idle on the website.
After a certain timeout a popup will be displayed warning the user that they will be logged out automatically after another 10 seconds.
Settings
To enable the plugin you will have to add it to the
DefaultPlugin
settings of JQueryPlugin so that it is loaded on every page.
$Foswiki::cfg{JQueryPlugin}{DefaultPlugins} = 'autologout';
Alternatively, you can add it to the current page using:
%JQREQUIRE{"autologout"}%
You may either put this in one of your skin templates or in a topic text.
The plugin may be configured by preference settings. Defaults are:
* Set AUTOLOGOUT_TIMEOUT = 900
* Set AUTOLOGOUT_COUNTDOWN = 10
* Set AUTOLOGOUT_URL = %SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%?logout=1
The jQuery plugin understands a few more options as can be seen in the
autologout.tmpl
file.
Parameter |
Description |
Default |
data-idle-timeout |
seconds after which the warning dialog will pop up |
%AUTOLOGOUT_TIMEOUT% or 900 if undefined (15 minutes) |
data-countdown |
number of seconds displayed in the logout popup warning after which the user will be logged out |
%AUTOLOGOUT_COUNTDOWN% or 10 otherwise |
data-logout-url |
the url which is used to log out the user; this may be any location on your Foswiki but must have the logout=1 url parameter attached to it to perform the actual logout procedure |
%AUTOLOGOUT_URL% or %SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%?logout=1 otherwise |
data-enable-if |
this is a jQuery selector that must be found on a page to start the auto logout process |
.natViewBody, .natBodyAuthenticated, body.patternViewPage, body.foswikiLoggedIn (covers NatSkin and PatternSkin) |
data-disable-if |
this is a jQuery selector that must NOT be found on a page or otherwise the auto logout process is supressed |
body.foswikiGuest, .natBodyNotAuthenticated (covers NatSkin and PatternSkin) |
data-events |
list of (space-separated) events that will restart the logout timer |
click mousemove scroll keypress |
Note that a single sign on login manager might log you in right after having you logged out temporarily. You might need to configure AUTOLOGOUT_URL
to a location that does not require authentication again.
Installation Instructions
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.
Open configure, and open the "Extensions" section. "Extensions Operation and Maintenance" Tab -> "Install, Update or Remove extensions" Tab. Click the "Search for Extensions" button.
Enter part of the extension name or description and press search. Select the desired extension(s) and click install. If an extension is already installed, it will
not show up in the
search results.
You can also install from the shell by running the extension installer as the web server user: (Be sure to run as the webserver user, not as root!)
cd /path/to/foswiki
perl tools/extension_installer <NameOfExtension> install
If you have any problems, or if the extension isn't available in
configure
, then you can still install manually from the command-line. See
https://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Dependencies
None
Change History
24 Jan 2024 |
fixed use of autologout tmpl definition |
21 Apr 2020 |
fixed manifest |
09 Dec 2018 |
improved algorithm |
07 Dec 2018 |
make it work on multiple tabs |
29 Nov 2018 |
initial release |