Fixed bug #17203: The ExtDirect token needs to be regenerated after relogin by popup...
authorSteffen Kamper <info@sk-typo3.de>
Sat, 22 Jan 2011 21:27:56 +0000 (21:27 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Sat, 22 Jan 2011 21:27:56 +0000 (21:27 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@10269 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_pagerenderer.php
typo3/classes/class.ajaxlogin.php
typo3/index.php
typo3/js/loginrefresh.js

index 6336a53..9ccfbf6 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2011-01-22  Steffen Kamper  <steffen@typo3.org>
 
+       * Fixed bug #17203: The ExtDirect token needs to be regenerated after relogin by popup window (Thanks to Helmut Hummel)
        * Merge of extension manager for RC1
 
 2011-01-22  Ernesto Baschny  <ernst@cron-it.de>
index ff6cd16..70582ae 100644 (file)
@@ -956,20 +956,20 @@ class t3lib_PageRenderer implements t3lib_Singleton {
                        // does this only with multiple arguments
                $this->addExtOnReadyCode('
                        (function() {
-                               var token = "' . $token . '";
+                               TYPO3.ExtDirectToken = "' . $token . '";
                                for (var api in Ext.app.ExtDirectAPI) {
                                        var provider = Ext.Direct.addProvider(Ext.app.ExtDirectAPI[api]);
                                        provider.on("beforecall", function(provider, transaction, meta) {
                                                if (transaction.data) {
-                                                       transaction.data[transaction.data.length] = token;
+                                                       transaction.data[transaction.data.length] = TYPO3.ExtDirectToken;
                                                } else {
-                                                       transaction.data = [token];
+                                                       transaction.data = [TYPO3.ExtDirectToken];
                                                }
                                        });
 
                                        provider.on("call", function(provider, transaction, meta) {
                                                if (transaction.isForm) {
-                                                       transaction.params.securityToken = token;
+                                                       transaction.params.securityToken = TYPO3.ExtDirectToken;
                                                }
                                        });
                                }
index 46ce405..db78628 100644 (file)
@@ -44,7 +44,14 @@ class AjaxLogin {
         */
        public function login(array $parameters, TYPO3AJAX $ajaxObj) {
                if ($GLOBALS['BE_USER']->user['uid']) {
-                       $json = array('success' => TRUE);
+                       $formprotection = t3lib_formprotection_Factory::get('t3lib_formprotection_BackendFormProtection');
+                       $token = $formprotection->generateToken('extDirect');
+                       $formprotection->persistTokens();
+
+                       $json = array(
+                               'success' => TRUE,
+                               'token' => $token
+                       );
                } else {
                        $json = array('success' => FALSE);
                }
index 84f4951..00a6115 100644 (file)
@@ -397,6 +397,9 @@ class SC_index {
                        if (!$this->loginRefresh)       {
                                t3lib_utility_Http::redirect($this->redirectToURL);
                        } else {
+                               $formprotection = t3lib_formprotection_Factory::get('t3lib_formprotection_BackendFormProtection');
+                               $token = $formprotection->generateToken('extDirect');
+                               $formprotection->persistTokens();
                                $TBE_TEMPLATE->JScode.=$TBE_TEMPLATE->wrapScriptTags('
                                        if (parent.opener && (parent.opener.busy || parent.opener.TYPO3.loginRefresh)) {
                                                if (parent.opener.TYPO3.loginRefresh) {
@@ -404,6 +407,7 @@ class SC_index {
                                                } else {
                                                        parent.opener.busy.loginRefreshed();
                                                }
+                                               parent.opener.TYPO3.ExtDirectToken = "' . $token . '";
                                                parent.close();
                                        }
                                ');
index 9024273..b8e79a9 100644 (file)
@@ -298,6 +298,7 @@ Ext.ux.TYPO3.loginRefresh = Ext.extend(Ext.util.Observable, {
                                                // User is logged in
                                                Ext.getCmp("loginformWindow").hide();
                                                TYPO3.loginRefresh.startTimer();
+                                               TYPO3.ExtDirectToken = result.token;
                                        } else {
                                                // TODO: add failure to notification system instead of alert
                                                Ext.Msg.alert(TYPO3.LLL.core.refresh_login_failed, TYPO3.LLL.core.refresh_login_failed_message);