Fixed bug #17498: The refresh login dialogue is shown even if the session already...
authorjigal <jigal@709f56b5-9817-0410-a4d7-c38de5d9e867>
Sun, 20 Feb 2011 17:57:30 +0000 (17:57 +0000)
committerjigal <jigal@709f56b5-9817-0410-a4d7-c38de5d9e867>
Sun, 20 Feb 2011 17:57:30 +0000 (17:57 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-5@10506 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/classes/class.ajaxlogin.php
typo3/js/loginrefresh.js

index 66ab875..8268eee 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-02-20  Jigal van Hemert  <jigal@xs4all.nl>
+
+       * Fixed bug #17498: The refresh login dialogue is shown even if the session already timed out (Thanks to Helmut Hummel)
+
 2011-02-19  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #17676: htmlArea RTE: Some combo stores are loaded twice
index fbced2e..ff3e1a9 100644 (file)
@@ -101,8 +101,10 @@ class AjaxLogin {
                if(is_object($GLOBALS['BE_USER'])) {
                        $ajaxObj->setContentFormat('json');
                        if (@is_file(PATH_typo3conf.'LOCK_BACKEND')) {
-                               $ajaxObj->addContent('login', array('timed_out' => FALSE, 'locked' => TRUE));
+                               $ajaxObj->addContent('login', array('will_time_out' => FALSE, 'locked' => TRUE));
                                $ajaxObj->setContentFormat('json');
+                       } else if (!isset($GLOBALS['BE_USER']->user['uid'])) {
+                               $ajaxObj->addContent('login', array('timed_out' => TRUE));
                        } else {
                                $GLOBALS['BE_USER']->fetchUserSession(TRUE);
                                $ses_tstamp = $GLOBALS['BE_USER']->user['ses_tstamp'];
@@ -111,9 +113,9 @@ class AjaxLogin {
                                // if 120 seconds from now is later than the session timeout, we need to show the refresh dialog.
                                // 120 is somewhat arbitrary to allow for a little room during the countdown and load times, etc.
                                if ($GLOBALS['EXEC_TIME'] >= $ses_tstamp + $timeout - 120) {
-                                       $ajaxObj->addContent('login', array('timed_out' => TRUE));
+                                       $ajaxObj->addContent('login', array('will_time_out' => TRUE));
                                } else {
-                                       $ajaxObj->addContent('login', array('timed_out' => FALSE));
+                                       $ajaxObj->addContent('login', array('will_time_out' => FALSE));
                                }
                        }
                } else {
index b8e79a9..854fd0a 100644 (file)
@@ -64,10 +64,14 @@ Ext.ux.TYPO3.loginRefresh = Ext.extend(Ext.util.Observable, {
                                                                Ext.MessageBox.hide();
                                                        }
                                                }
-                                               if (result.login.timed_out && Ext.getCmp("loginformWindow")) {
+                                               if ((result.login.timed_out || result.login.will_time_out) && Ext.getCmp("loginformWindow")) {
                                                        Ext.getCmp("login_username").value = TYPO3.configuration.username;
                                                        this.stopTimer();
-                                                       this.progressWindow.show();
+                                                       if (result.login.timed_out) {
+                                                               this.showLoginForm();
+                                                       } else {
+                                                               this.progressWindow.show();
+                                                       }
                                                }
                                        },
                                        failure: function() {
@@ -208,27 +212,8 @@ Ext.ux.TYPO3.loginRefresh = Ext.extend(Ext.util.Observable, {
                                duration: 30000,
                                increment: 32,
                                text: String.format(TYPO3.LLL.core.refresh_login_countdown, '30'),
-                               fn: function(win){
-                                       if (TYPO3.configuration.showRefreshLoginPopup) {
-                                               //log off for sure
-                                               Ext.Ajax.request({
-                                                       url: "ajax.php",
-                                                       params: {
-                                                               "ajaxID": "BackendLogin::logout"
-                                                       },
-                                                       method: "GET",
-                                                       scope: this,
-                                                       success: function(response, opts) {
-                                                               TYPO3.loginRefresh.showLoginPopup();
-                                                       },
-                                                       failure: function(response, opts) {
-                                                               alert("something went wrong");
-                                                       }
-                                               });
-                                       } else {
-                                               Ext.getCmp("loginRefreshWindow").hide();
-                                               Ext.getCmp("loginformWindow").show();
-                                       }
+                               fn: function() {
+                                       TYPO3.loginRefresh.showLoginForm();
                                }
                        });
 
@@ -241,12 +226,35 @@ Ext.ux.TYPO3.loginRefresh = Ext.extend(Ext.util.Observable, {
                                control.updateText(String.format(TYPO3.LLL.core.refresh_login_countdown, rest));
                        }
                });
-
+               
                this.loginRefreshWindow.on('close', function(){
                        TYPO3.loginRefresh.startTimer();
                });
        },
 
+       showLoginForm: function() {
+               if (TYPO3.configuration.showRefreshLoginPopup) {
+                       //log off for sure
+                       Ext.Ajax.request({
+                               url: "ajax.php",
+                               params: {
+                               "ajaxID": "BackendLogin::logout"
+                       },
+                       method: "GET",
+                       scope: this,
+                       success: function(response, opts) {
+                               TYPO3.loginRefresh.showLoginPopup();
+                       },
+                       failure: function(response, opts) {
+                               alert("something went wrong");
+                       }
+                       });
+               } else {
+                       Ext.getCmp("loginRefreshWindow").hide();
+                       Ext.getCmp("loginformWindow").show();
+               }
+       },
+
        showLoginPopup: function() {
                Ext.getCmp("loginRefreshWindow").hide();
                var vHWin = window.open("login_frameset.php","relogin_" + TS.uniqueID,"height=450,width=700,status=0,menubar=0,location=1");