User:Revansx/Session Notification of Renewal

This script is aimed at wikis using a 3rd party identity provider provided via an immutable session header. Specifically, CA Policy Agent.


 * The problem this script solves is when the 3rd party immutable session provider sets a 15 minute timer on session expiration due to client inactivity.. which happens all the time when people spend more than 15 minutes editing a page without saving.. when the session expires.. the CA Policy agent forces a redirect to renew the session, but for edit pages with pending edits, the pending edits get lost.

Pasting this javascript code into your "Mediawiki:Common.js" page will cause a little bright yellow pop-up dialog box to show up in any page with "action=edit" or "veaction=edit" in the url. This is to notify the user that they may need to re-new their session before attempting to save their work. The javascript dialog box links to the Pasting this javascript code into your "Mediawiki:Common.js" page will cause a little bright yellow pop-up dialog box to show up in any page with "action=edit" or "veaction=edit" in the url. This is to notify the user that they made need to re-new their session before attempting to save their work. The javascript dialog box links to the page "renew.php" that you should implement somewhere on your server that the user can access with an expired session. "renew.php" is essentially a user initiated request that forces the SSO to renew the session.

Mediawiki:Common.css code
This is needed to overcome a CSS issue with respect to the way Visual Editor works with notifications (Ref: Topic:Ui0cnigoxel6v79u) .mw-notification-area-layout { pointer-events:initial; opacity:1.0; display:inline; }
 * 1) mw-notification-area       { pointer-events:initial; opacity:1.0; display:inline; }

renew.php code
This works, but not as well as I'd like. Renew the session This page was generated simply for the purpose of renewing the session.It will attempt to automatically close in 3 seconds.If the browser asks you if you want to close the page, please say "yes".Once closed, you should be returned to your work in the Wiki and you should close the session expiration notification dialog box.  function mynotify3  { setTimeout(function { document.body.innerHTML = "This page was generated simply for the purpose of renewing the session. It will automatically close in 3 seconds."; }, 1); } function mynotify2  { setTimeout(function { document.body.innerHTML = "This page was generated simply for the purpose of renewing the session. It will automatically close in 2 seconds."; }, 1000); } function mynotify1  { setTimeout(function { document.body.innerHTML = "This page was generated simply for the purpose of renewing the session. It will automatically close in 1 seconds."; }, 2000); } function closeWindow { setTimeout(function { window.close; }, 3000); } window.onload = mynotify3; window.onload = mynotify2; window.onload = mynotify1; window.onload = closeWindow;