[FEATURE] felogin: Add hook before HTTP redirect
authorXavier Perseguers <typo3@perseguers.ch>
Fri, 22 Jul 2011 11:14:24 +0000 (13:14 +0200)
committerXavier Perseguers <typo3@perseguers.ch>
Wed, 27 Jul 2011 17:27:33 +0000 (19:27 +0200)
Implement hook into the login process after a successful login if a
redirect is performed. When no redirect is performed, postProcContent
may be used to perform additional actions.

Change-Id: Id6259fb7c843ad08432f1df27a15963276e08611
Resolves: #23671
Releases: 4.6
Reviewed-on: http://review.typo3.org/3471
Reviewed-by: Helmut Hummel
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
typo3/sysext/felogin/pi1/class.tx_felogin_pi1.php

index e3b70fc..390a6a7 100644 (file)
@@ -133,6 +133,18 @@ class tx_felogin_pi1 extends tslib_pibase {
                        if (!$GLOBALS['TSFE']->fe_user->cookieId) {
                                $content .= $this->cObj->stdWrap($this->pi_getLL('cookie_warning', '', 1), $this->conf['cookieWarning_stdWrap.']);
                        } else {
+                                       // Add hook for extra processing before redirect
+                               if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['beforeRedirect']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['beforeRedirect'])) {
+                                       $_params = array(
+                                               'loginType'   => $this->logintype,
+                                               'redirectUrl' => &$this->redirectUrl,
+                                       );
+                                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['beforeRedirect'] as $_funcRef) {
+                                               if ($_funcRef) {
+                                                       t3lib_div::callUserFunction($_funcRef, $_params, $this);
+                                               }
+                                       }
+                               }
                                t3lib_utility_Http::redirect($this->redirectUrl);
                        }
                }