Changes
Title
unchanged
Checking for "expired" sessions/logins on the client side
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
csrf, login, cookie, UserIdentity, user auth, security, session, allowAutoLogin, Cache-Control
Content
changed
[...]
In the proposed methods, the popups are modal to force the user to reload or close the page.
You should use your own CWebUser subclass as indicated below for full functionnality.
I haven't set up a test case to demonstrate the issue, but the following procedure should demonstrate the issue:
- Open a web page in your browser with a form relying on the YII_CSRF_TOKEN for submitting the data.
- Close the browser (with the reopen tabs functionnality active);
- Reopen the browser -> your form page should appear.[...]
*/
public static function MonitorSessionJQueryDialog($timeout=2,$showCloseButton=true) {
Yii::app()->clientScript->registerCoreScript('jquery-.ui');
$title=CJavaScript::encode(Yii::t('app','Session Expired'));
$msg=CJavaScript::encode(CHtml::tag('div',array(),Yii::t('app','Your session expired and this page must be reloaded.')));
$btReload=CJavaScript::encode(Yii::t('app','Reload'));
if($showCloseButton) {
$btClose=CJavaScript::encode(Yii::t('app','Close'));[...]