[TASK] Make felogin/Test/Unit notice free
[Packages/TYPO3.CMS.git] / typo3 / sysext / felogin / Classes / Controller / FrontendLoginController.php
1 <?php
2 namespace TYPO3\CMS\Felogin\Controller;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use Psr\Log\LoggerAwareInterface;
18 use Psr\Log\LoggerAwareTrait;
19 use TYPO3\CMS\Core\Authentication\LoginType;
20 use TYPO3\CMS\Core\Context\Context;
21 use TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory;
22 use TYPO3\CMS\Core\Crypto\Random;
23 use TYPO3\CMS\Core\Database\Connection;
24 use TYPO3\CMS\Core\Database\ConnectionPool;
25 use TYPO3\CMS\Core\Database\Query\Restriction\FrontendRestrictionContainer;
26 use TYPO3\CMS\Core\Utility\GeneralUtility;
27 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
28 use TYPO3\CMS\Frontend\Plugin\AbstractPlugin;
29
30 /**
31 * Plugin 'Website User Login' for the 'felogin' extension.
32 */
33 class FrontendLoginController extends AbstractPlugin implements LoggerAwareInterface
34 {
35 use LoggerAwareTrait;
36
37 /**
38 * Same as class name
39 *
40 * @var string
41 */
42 public $prefixId = 'tx_felogin_pi1';
43
44 /**
45 * The extension key.
46 *
47 * @var string
48 */
49 public $extKey = 'felogin';
50
51 /**
52 * @var bool
53 */
54 public $pi_checkCHash = false;
55
56 /**
57 * @var bool
58 */
59 public $pi_USER_INT_obj = true;
60
61 /**
62 * Is user logged in?
63 *
64 * @var bool
65 */
66 protected $userIsLoggedIn;
67
68 /**
69 * Holds the template for FE rendering
70 *
71 * @var string
72 */
73 protected $template;
74
75 /**
76 * URL for the redirect
77 *
78 * @var string
79 */
80 protected $redirectUrl;
81
82 /**
83 * Flag for disable the redirect
84 *
85 * @var bool
86 */
87 protected $noRedirect = false;
88
89 /**
90 * Logintype (given as GPvar), possible: login, logout
91 *
92 * @var string
93 */
94 protected $logintype;
95
96 /**
97 * A list of page UIDs, either an integer or a comma-separated list of integers
98 *
99 * @var string
100 */
101 public $spid;
102
103 /**
104 * Referrer
105 *
106 * @var string
107 */
108 public $referer;
109
110 /**
111 * The main method of the plugin
112 *
113 * @param string $content The PlugIn content
114 * @param array $conf The PlugIn configuration
115 * @return string The content that is displayed on the website
116 * @throws \RuntimeException when no storage PID was configured.
117 */
118 public function main($content, $conf)
119 {
120 // Loading TypoScript array into object variable:
121 $this->conf = $conf;
122 // Loading default pivars
123 $this->pi_setPiVarDefaults();
124 // Loading language-labels
125 $this->pi_loadLL('EXT:felogin/Resources/Private/Language/locallang.xlf');
126 // Init FlexForm configuration for plugin:
127 $this->pi_initPIflexForm();
128 $this->mergeflexFormValuesIntoConf();
129 // Get storage PIDs:
130 if ($this->conf['storagePid']) {
131 if ((int)$this->conf['recursive']) {
132 $this->spid = $this->pi_getPidList($this->conf['storagePid'], (int)$this->conf['recursive']);
133 } else {
134 $this->spid = $this->conf['storagePid'];
135 }
136 } else {
137 throw new \RuntimeException('No storage folder (option storagePid) for frontend users given.', 1450904202);
138 }
139 // GPvars:
140 $this->logintype = GeneralUtility::_GP('logintype');
141 $this->referer = $this->validateRedirectUrl(GeneralUtility::_GP('referer'));
142 $this->noRedirect = $this->piVars['noredirect'] || $this->conf['redirectDisable'];
143 // If config.typolinkLinkAccessRestrictedPages is set, the var is return_url
144 $returnUrl = GeneralUtility::_GP('return_url');
145 if ($returnUrl) {
146 $this->redirectUrl = $returnUrl;
147 } else {
148 $this->redirectUrl = GeneralUtility::_GP('redirect_url');
149 }
150 $this->redirectUrl = $this->validateRedirectUrl($this->redirectUrl);
151 // Get Template
152 $templateFile = $this->conf['templateFile'] ?: 'EXT:felogin/Resources/Private/Templates/FrontendLogin.html';
153 $template = GeneralUtility::getFileAbsFileName($templateFile);
154 if ($template !== '' && file_exists($template)) {
155 $this->template = file_get_contents($template);
156 }
157 // Is user logged in?
158 $this->userIsLoggedIn = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('frontend.user', 'isLoggedIn');
159 // Redirect
160 if ($this->conf['redirectMode'] && !$this->conf['redirectDisable'] && !$this->noRedirect) {
161 $redirectUrl = $this->processRedirect();
162 if (!empty($redirectUrl)) {
163 $this->redirectUrl = $this->conf['redirectFirstMethod'] ? array_shift($redirectUrl) : array_pop($redirectUrl);
164 } else {
165 $this->redirectUrl = '';
166 }
167 }
168 // What to display
169 $content = '';
170 if ($this->piVars['forgot'] && $this->conf['showForgotPasswordLink']) {
171 $content .= $this->showForgot();
172 } elseif ($this->piVars['forgothash']) {
173 $content .= $this->changePassword();
174 } else {
175 if ($this->userIsLoggedIn && !$this->logintype) {
176 $content .= $this->showLogout();
177 } else {
178 $content .= $this->showLogin();
179 }
180 }
181 // Process the redirect
182 if (($this->logintype === LoginType::LOGIN || $this->logintype === LoginType::LOGOUT) && $this->redirectUrl && !$this->noRedirect) {
183 if (!$this->frontendController->fe_user->isCookieSet() && $this->userIsLoggedIn) {
184 $content .= $this->cObj->stdWrap($this->pi_getLL('cookie_warning'), $this->conf['cookieWarning_stdWrap.']);
185 } else {
186 // Add hook for extra processing before redirect
187 $_params = [
188 'loginType' => $this->logintype,
189 'redirectUrl' => &$this->redirectUrl
190 ];
191 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['beforeRedirect'] ?? [] as $_funcRef) {
192 if ($_funcRef) {
193 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
194 }
195 }
196 \TYPO3\CMS\Core\Utility\HttpUtility::redirect($this->redirectUrl);
197 }
198 }
199 // Adds hook for processing of extra item markers / special
200 $_params = [
201 'content' => $content
202 ];
203 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['postProcContent'] ?? [] as $_funcRef) {
204 $content = GeneralUtility::callUserFunction($_funcRef, $_params, $this);
205 }
206 return $this->conf['wrapContentInBaseClass'] ? $this->pi_wrapInBaseClass($content) : $content;
207 }
208
209 /**
210 * Shows the forgot password form
211 *
212 * @return string Content
213 */
214 protected function showForgot()
215 {
216 $subpart = $this->templateService->getSubpart($this->template, '###TEMPLATE_FORGOT###');
217 $subpartArray = ($linkpartArray = []);
218 $postData = GeneralUtility::_POST($this->prefixId);
219 if ($postData['forgot_email']) {
220 // Get hashes for compare
221 $postedHash = $postData['forgot_hash'];
222 $hashData = $this->frontendController->fe_user->getKey('ses', 'forgot_hash');
223 if ($postedHash === $hashData['forgot_hash']) {
224 $userTable = $this->frontendController->fe_user->user_table;
225 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($userTable);
226 $queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
227 $row = $queryBuilder
228 ->select('*')
229 ->from($userTable)
230 ->where(
231 $queryBuilder->expr()->orX(
232 $queryBuilder->expr()->eq(
233 'email',
234 $queryBuilder->createNamedParameter($this->piVars['forgot_email'], \PDO::PARAM_STR)
235 ),
236 $queryBuilder->expr()->eq(
237 'username',
238 $queryBuilder->createNamedParameter($this->piVars['forgot_email'], \PDO::PARAM_STR)
239 )
240 ),
241 $queryBuilder->expr()->in(
242 'pid',
243 $queryBuilder->createNamedParameter(
244 GeneralUtility::intExplode(',', $this->spid),
245 Connection::PARAM_INT_ARRAY
246 )
247 )
248 )
249 ->execute()
250 ->fetch();
251
252 $error = null;
253 if ($row) {
254 // Generate an email with the hashed link
255 $error = $this->generateAndSendHash($row);
256 } elseif ($this->conf['exposeNonexistentUserInForgotPasswordDialog']) {
257 $error = $this->pi_getLL('ll_forgot_reset_message_error');
258 }
259 // Generate message
260 if ($error) {
261 $markerArray['###STATUS_MESSAGE###'] = $this->cObj->stdWrap($error, $this->conf['forgotErrorMessage_stdWrap.']);
262 } else {
263 $markerArray['###STATUS_MESSAGE###'] = $this->cObj->stdWrap(
264 $this->pi_getLL('ll_forgot_reset_message_emailSent'),
265 $this->conf['forgotResetMessageEmailSentMessage_stdWrap.']
266 );
267 }
268 $subpartArray['###FORGOT_FORM###'] = '';
269 } else {
270 // Wrong email
271 $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('forgot_reset_message', $this->conf['forgotMessage_stdWrap.']);
272 $markerArray['###BACKLINK_LOGIN###'] = '';
273 }
274 } else {
275 $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('forgot_reset_message', $this->conf['forgotMessage_stdWrap.']);
276 $markerArray['###BACKLINK_LOGIN###'] = '';
277 }
278 $markerArray['###BACKLINK_LOGIN###'] = $this->getPageLink(htmlspecialchars($this->pi_getLL('ll_forgot_header_backToLogin')), []);
279 $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('forgot_header', $this->conf['forgotHeader_stdWrap.']);
280 $markerArray['###LEGEND###'] = htmlspecialchars($this->pi_getLL('legend', $this->pi_getLL('reset_password')));
281 $markerArray['###ACTION_URI###'] = $this->getPageLink('', [$this->prefixId . '[forgot]' => 1], true);
282 $markerArray['###EMAIL_LABEL###'] = htmlspecialchars($this->pi_getLL('your_email'));
283 $markerArray['###FORGOT_PASSWORD_ENTEREMAIL###'] = htmlspecialchars($this->pi_getLL('forgot_password_enterEmail'));
284 $markerArray['###FORGOT_EMAIL###'] = $this->prefixId . '[forgot_email]';
285 $markerArray['###SEND_PASSWORD###'] = htmlspecialchars($this->pi_getLL('reset_password'));
286 $markerArray['###DATA_LABEL###'] = htmlspecialchars($this->pi_getLL('ll_enter_your_data'));
287 $markerArray = array_merge($markerArray, $this->getUserFieldMarkers());
288 // Generate hash
289 $hash = md5($this->generatePassword(3));
290 $markerArray['###FORGOTHASH###'] = $hash;
291 // Set hash in feuser session
292 $this->frontendController->fe_user->setKey('ses', 'forgot_hash', ['forgot_hash' => $hash]);
293 return $this->templateService->substituteMarkerArrayCached($subpart, $markerArray, $subpartArray, $linkpartArray);
294 }
295
296 /**
297 * This function checks the hash from link and checks the validity. If it's valid it shows the form for
298 * changing the password and process the change of password after submit, if not valid it returns the error message
299 *
300 * @return string The content.
301 */
302 protected function changePassword()
303 {
304 $subpartArray = ($linkpartArray = []);
305 $done = false;
306 $minLength = (int)$this->conf['newPasswordMinLength'] ?: 6;
307 $subpart = $this->templateService->getSubpart($this->template, '###TEMPLATE_CHANGEPASSWORD###');
308 $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('change_password_header', $this->conf['changePasswordHeader_stdWrap.']);
309 $markerArray['###STATUS_MESSAGE###'] = sprintf($this->getDisplayText(
310 'change_password_message',
311 $this->conf['changePasswordMessage_stdWrap.']
312 ), $minLength);
313
314 $markerArray['###BACKLINK_LOGIN###'] = '';
315 $uid = $this->piVars['user'];
316 $piHash = $this->piVars['forgothash'];
317 $hash = explode('|', rawurldecode($piHash));
318 if ((int)$uid === 0) {
319 $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText(
320 'change_password_notvalid_message',
321 $this->conf['changePasswordNotValidMessage_stdWrap.']
322 );
323 $subpartArray['###CHANGEPASSWORD_FORM###'] = '';
324 } else {
325 $user = $this->pi_getRecord('fe_users', (int)$uid);
326 $userHash = $user['felogin_forgotHash'];
327 $compareHash = explode('|', $userHash);
328 if (!$compareHash || !$compareHash[1] || $compareHash[0] < time() || $hash[0] != $compareHash[0] || md5($hash[1]) != $compareHash[1]) {
329 $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText(
330 'change_password_notvalid_message',
331 $this->conf['changePasswordNotValidMessage_stdWrap.']
332 );
333 $subpartArray['###CHANGEPASSWORD_FORM###'] = '';
334 } else {
335 // All is fine, continue with new password
336 $postData = GeneralUtility::_POST($this->prefixId);
337 if (isset($postData['changepasswordsubmit'])) {
338 if (strlen($postData['password1']) < $minLength) {
339 $markerArray['###STATUS_MESSAGE###'] = sprintf(
340 $this->getDisplayText(
341 'change_password_tooshort_message',
342 $this->conf['changePasswordTooShortMessage_stdWrap.']
343 ),
344 $minLength
345 );
346 } elseif ($postData['password1'] != $postData['password2']) {
347 $markerArray['###STATUS_MESSAGE###'] = sprintf(
348 $this->getDisplayText(
349 'change_password_notequal_message',
350 $this->conf['changePasswordNotEqualMessage_stdWrap.']
351 ),
352 $minLength
353 );
354 } else {
355 // Hash password using configured salted passwords hash mechanism for FE
356 $hashInstance = GeneralUtility::makeInstance(PasswordHashFactory::class)->getDefaultHashInstance('FE');
357 $newPass = $hashInstance->getHashedPassword($postData['password1']);
358
359 // Call a hook for further password processing
360 if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['password_changed']) {
361 $_params = [
362 'user' => $user,
363 'newPassword' => $newPass,
364 'newPasswordUnencrypted' => $postData['password1']
365 ];
366 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['password_changed'] as $_funcRef) {
367 if ($_funcRef) {
368 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
369 }
370 }
371 $newPass = $_params['newPassword'];
372 }
373
374 // Save new password and clear DB-hash
375 $userTable = $this->frontendController->fe_user->user_table;
376 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($userTable);
377 $queryBuilder->getRestrictions()->removeAll();
378 $queryBuilder->update($userTable)
379 ->set('password', $newPass)
380 ->set('felogin_forgotHash', '')
381 ->set('tstamp', (int)$GLOBALS['EXEC_TIME'])
382 ->where(
383 $queryBuilder->expr()->eq(
384 'uid',
385 $queryBuilder->createNamedParameter($user['uid'], \PDO::PARAM_INT)
386 )
387 )
388 ->execute();
389
390 $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText(
391 'change_password_done_message',
392 $this->conf['changePasswordDoneMessage_stdWrap.']
393 );
394 $done = true;
395 $subpartArray['###CHANGEPASSWORD_FORM###'] = '';
396 $markerArray['###BACKLINK_LOGIN###'] = $this->getPageLink(
397 htmlspecialchars($this->pi_getLL('ll_forgot_header_backToLogin')),
398 [$this->prefixId . '[redirectReferrer]' => 'off']
399 );
400 }
401 }
402 if (!$done) {
403 // Change password form
404 $markerArray['###ACTION_URI###'] = $this->getPageLink('', [
405 $this->prefixId . '[user]' => $user['uid'],
406 $this->prefixId . '[forgothash]' => $piHash
407 ], true);
408 $markerArray['###LEGEND###'] = htmlspecialchars($this->pi_getLL('change_password'));
409 $markerArray['###NEWPASSWORD1_LABEL###'] = htmlspecialchars($this->pi_getLL('newpassword_label1'));
410 $markerArray['###NEWPASSWORD2_LABEL###'] = htmlspecialchars($this->pi_getLL('newpassword_label2'));
411 $markerArray['###NEWPASSWORD1###'] = $this->prefixId . '[password1]';
412 $markerArray['###NEWPASSWORD2###'] = $this->prefixId . '[password2]';
413 $markerArray['###STORAGE_PID###'] = $this->spid;
414 $markerArray['###SEND_PASSWORD###'] = htmlspecialchars($this->pi_getLL('change_password'));
415 $markerArray['###FORGOTHASH###'] = $piHash;
416 }
417 }
418 }
419 return $this->templateService->substituteMarkerArrayCached($subpart, $markerArray, $subpartArray, $linkpartArray);
420 }
421
422 /**
423 * Generates a hashed link and send it with email
424 *
425 * @param array $user Contains user data
426 * @return string Empty string with success, error message with no success
427 */
428 protected function generateAndSendHash($user)
429 {
430 $hours = (int)$this->conf['forgotLinkHashValidTime'] > 0 ? (int)$this->conf['forgotLinkHashValidTime'] : 24;
431 $validEnd = time() + 3600 * $hours;
432 $validEndString = date($this->conf['dateFormat'], $validEnd);
433 $hash = md5(GeneralUtility::makeInstance(Random::class)->generateRandomBytes(64));
434 $randHash = $validEnd . '|' . $hash;
435 $randHashDB = $validEnd . '|' . md5($hash);
436
437 // Write hash to DB
438 $userTable = $this->frontendController->fe_user->user_table;
439 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($userTable);
440 $queryBuilder->getRestrictions()->removeAll();
441 $queryBuilder->update($userTable)
442 ->set('felogin_forgotHash', $randHashDB)
443 ->where(
444 $queryBuilder->expr()->eq(
445 'uid',
446 $queryBuilder->createNamedParameter($user['uid'], \PDO::PARAM_INT)
447 )
448 )
449 ->execute();
450
451 // Send hashlink to user
452 $this->conf['linkPrefix'] = -1;
453 $isAbsRefPrefix = !empty($this->frontendController->absRefPrefix);
454 $isBaseURL = !empty($this->frontendController->baseUrl);
455 $isFeloginBaseURL = !empty($this->conf['feloginBaseURL']);
456 $link = $this->pi_getPageLink($this->frontendController->id, '', [
457 rawurlencode($this->prefixId . '[user]') => $user['uid'],
458 rawurlencode($this->prefixId . '[forgothash]') => $randHash
459 ]);
460 // Prefix link if necessary
461 if ($isFeloginBaseURL) {
462 // First priority, use specific base URL
463 // "absRefPrefix" must be removed first, otherwise URL will be prepended twice
464 if ($isAbsRefPrefix) {
465 $link = substr($link, strlen($this->frontendController->absRefPrefix));
466 }
467 $link = $this->conf['feloginBaseURL'] . $link;
468 } elseif ($isAbsRefPrefix) {
469 // Second priority
470 // absRefPrefix must not necessarily contain a hostname and URL scheme, so add it if needed
471 $link = GeneralUtility::locationHeaderUrl($link);
472 } elseif ($isBaseURL) {
473 // Third priority
474 // Add the global base URL to the link
475 $link = $this->frontendController->baseUrlWrap($link);
476 } else {
477 // No prefix is set, return the error
478 return $this->pi_getLL('ll_change_password_nolinkprefix_message');
479 }
480 $msg = sprintf($this->pi_getLL('ll_forgot_validate_reset_password'), $user['username'], $link, $validEndString);
481 // Add hook for extra processing of mail message
482 $params = [
483 'message' => &$msg,
484 'user' => &$user
485 ];
486 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['forgotPasswordMail'] ?? [] as $reference) {
487 if ($reference) {
488 GeneralUtility::callUserFunction($reference, $params, $this);
489 }
490 }
491 if ($user['email']) {
492 $this->cObj->sendNotifyEmail($msg, $user['email'], '', $this->conf['email_from'], $this->conf['email_fromName'], $this->conf['replyTo']);
493 }
494
495 return '';
496 }
497
498 /**
499 * Shows logout form
500 *
501 * @return string The content.
502 */
503 protected function showLogout()
504 {
505 $subpart = $this->templateService->getSubpart($this->template, '###TEMPLATE_LOGOUT###');
506 $subpartArray = ($linkpartArray = []);
507 $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('status_header', $this->conf['logoutHeader_stdWrap.']);
508 $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('status_message', $this->conf['logoutMessage_stdWrap.']);
509 $this->cObj->stdWrap($this->flexFormValue('message', 's_status'), $this->conf['logoutMessage_stdWrap.']);
510 $markerArray['###LEGEND###'] = htmlspecialchars($this->pi_getLL('logout'));
511 $markerArray['###ACTION_URI###'] = $this->getPageLink('', [], true);
512 $markerArray['###LOGOUT_LABEL###'] = htmlspecialchars($this->pi_getLL('logout'));
513 $markerArray['###NAME###'] = htmlspecialchars($this->frontendController->fe_user->user['name']);
514 $markerArray['###STORAGE_PID###'] = $this->spid;
515 $markerArray['###USERNAME###'] = htmlspecialchars($this->frontendController->fe_user->user['username']);
516 $markerArray['###USERNAME_LABEL###'] = htmlspecialchars($this->pi_getLL('username'));
517 $markerArray['###NOREDIRECT###'] = $this->noRedirect ? '1' : '0';
518 $markerArray['###PREFIXID###'] = $this->prefixId;
519 $markerArray = array_merge($markerArray, $this->getUserFieldMarkers());
520 if ($this->redirectUrl) {
521 // Use redirectUrl for action tag because of possible access restricted pages
522 $markerArray['###ACTION_URI###'] = htmlspecialchars($this->redirectUrl);
523 $this->redirectUrl = '';
524 }
525 return $this->templateService->substituteMarkerArrayCached($subpart, $markerArray, $subpartArray, $linkpartArray);
526 }
527
528 /**
529 * Shows login form
530 *
531 * @return string Content
532 */
533 protected function showLogin()
534 {
535 $subpart = $this->templateService->getSubpart($this->template, '###TEMPLATE_LOGIN###');
536 $subpartArray = ($linkpartArray = ($markerArray = []));
537 $gpRedirectUrl = '';
538 $markerArray['###LEGEND###'] = htmlspecialchars($this->pi_getLL('oLabel_header_welcome'));
539 if ($this->logintype === LoginType::LOGIN) {
540 if ($this->userIsLoggedIn) {
541 // login success
542 $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('success_header', $this->conf['successHeader_stdWrap.']);
543 $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('success_message', $this->conf['successMessage_stdWrap.']);
544 $markerArray = array_merge($markerArray, $this->getUserFieldMarkers());
545 $subpartArray['###LOGIN_FORM###'] = '';
546 // Hook for general actions after after login has been confirmed (by Thomas Danzl <thomas@danzl.org>)
547 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['login_confirmed'] ?? [] as $_funcRef) {
548 $_params = [];
549 if ($_funcRef) {
550 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
551 }
552 }
553 // show logout form directly
554 if ($this->conf['showLogoutFormAfterLogin']) {
555 $this->redirectUrl = '';
556 return $this->showLogout();
557 }
558 } else {
559 // Hook for general actions on login error
560 $params = [];
561 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['login_error'] ?? [] as $funcRef) {
562 if ($funcRef) {
563 GeneralUtility::callUserFunction($funcRef, $params, $this);
564 }
565 }
566 // login error
567 $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('error_header', $this->conf['errorHeader_stdWrap.']);
568 $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('error_message', $this->conf['errorMessage_stdWrap.']);
569 $gpRedirectUrl = GeneralUtility::_GP('redirect_url');
570 }
571 } else {
572 if ($this->logintype === LoginType::LOGOUT) {
573 // login form after logout
574 $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('logout_header', $this->conf['logoutHeader_stdWrap.']);
575 $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('logout_message', $this->conf['logoutMessage_stdWrap.']);
576 } else {
577 // login form
578 $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('welcome_header', $this->conf['welcomeHeader_stdWrap.']);
579 $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('welcome_message', $this->conf['welcomeMessage_stdWrap.']);
580 }
581 }
582
583 // This hook allows to call User JS functions.
584 // The methods should also set the required JS functions to get included
585 $onSubmit = '';
586 $extraHidden = '';
587 $onSubmitAr = [];
588 $extraHiddenAr = [];
589 // Check for referer redirect method. if present, save referer in form field
590 if (GeneralUtility::inList($this->conf['redirectMode'], 'referer') || GeneralUtility::inList($this->conf['redirectMode'], 'refererDomains')) {
591 $referer = $this->referer ? $this->referer : GeneralUtility::getIndpEnv('HTTP_REFERER');
592 if ($referer) {
593 $extraHiddenAr[] = '<input type="hidden" name="referer" value="' . htmlspecialchars($referer) . '" />';
594 if ($this->piVars['redirectReferrer'] === 'off') {
595 $extraHiddenAr[] = '<input type="hidden" name="' . $this->prefixId . '[redirectReferrer]" value="off" />';
596 }
597 }
598 }
599 $_params = [];
600 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'] ?? [] as $funcRef) {
601 list($onSub, $hid) = GeneralUtility::callUserFunction($funcRef, $_params, $this);
602 $onSubmitAr[] = $onSub;
603 $extraHiddenAr[] = $hid;
604 }
605 if (!empty($onSubmitAr)) {
606 $onSubmit = implode('; ', $onSubmitAr) . '; return true;';
607 }
608 if (!empty($extraHiddenAr)) {
609 $extraHidden = implode(LF, $extraHiddenAr);
610 }
611 if (!$gpRedirectUrl && $this->redirectUrl) {
612 $gpRedirectUrl = $this->redirectUrl;
613 }
614 // Login form
615 $markerArray['###ACTION_URI###'] = $this->getPageLink('', [], true);
616 // Used by kb_md5fepw extension...
617 $markerArray['###EXTRA_HIDDEN###'] = $extraHidden;
618 $markerArray['###LEGEND###'] = htmlspecialchars($this->pi_getLL('login'));
619 $markerArray['###LOGIN_LABEL###'] = htmlspecialchars($this->pi_getLL('login'));
620 // Used by kb_md5fepw extension...
621 $markerArray['###ON_SUBMIT###'] = $onSubmit;
622 $markerArray['###PASSWORD_LABEL###'] = htmlspecialchars($this->pi_getLL('password'));
623 $markerArray['###STORAGE_PID###'] = $this->spid;
624 $markerArray['###USERNAME_LABEL###'] = htmlspecialchars($this->pi_getLL('username'));
625 $markerArray['###REDIRECT_URL###'] = htmlspecialchars($gpRedirectUrl);
626 $markerArray['###NOREDIRECT###'] = $this->noRedirect ? '1' : '0';
627 $markerArray['###PREFIXID###'] = $this->prefixId;
628 $markerArray = array_merge($markerArray, $this->getUserFieldMarkers());
629 if ($this->conf['showForgotPasswordLink']) {
630 $linkpartArray['###FORGOT_PASSWORD_LINK###'] = explode('|', $this->getPageLink('|', [$this->prefixId . '[forgot]' => 1]));
631 $markerArray['###FORGOT_PASSWORD###'] = htmlspecialchars($this->pi_getLL('ll_forgot_header'));
632 } else {
633 $subpartArray['###FORGOTP_VALID###'] = '';
634 }
635 // The permanent login checkbox should only be shown if permalogin is not deactivated (-1),
636 // not forced to be always active (2) and lifetime is greater than 0
637 $permalogin = (int)$GLOBALS['TYPO3_CONF_VARS']['FE']['permalogin'];
638 if (
639 $this->conf['showPermaLogin']
640 && ($permalogin === 0 || $permalogin === 1)
641 && $GLOBALS['TYPO3_CONF_VARS']['FE']['lifetime'] > 0
642 ) {
643 $markerArray['###PERMALOGIN###'] = htmlspecialchars($this->pi_getLL('permalogin'));
644 if ($permalogin === 1) {
645 $markerArray['###PERMALOGIN_HIDDENFIELD_ATTRIBUTES###'] = 'disabled="disabled"';
646 $markerArray['###PERMALOGIN_CHECKBOX_ATTRIBUTES###'] = 'checked="checked"';
647 } else {
648 $markerArray['###PERMALOGIN_HIDDENFIELD_ATTRIBUTES###'] = '';
649 $markerArray['###PERMALOGIN_CHECKBOX_ATTRIBUTES###'] = '';
650 }
651 } else {
652 $subpartArray['###PERMALOGIN_VALID###'] = '';
653 }
654 return $this->templateService->substituteMarkerArrayCached($subpart, $markerArray, $subpartArray, $linkpartArray);
655 }
656
657 /**
658 * Process redirect methods. The function searches for a redirect url using all configured methods.
659 *
660 * @return array Redirect URLs
661 */
662 protected function processRedirect()
663 {
664 $redirect_url = [];
665 if ($this->conf['redirectMode']) {
666 $redirectMethods = GeneralUtility::trimExplode(',', $this->conf['redirectMode'], true);
667 foreach ($redirectMethods as $redirMethod) {
668 if ($this->userIsLoggedIn && $this->logintype === LoginType::LOGIN) {
669 // Logintype is needed because the login-page wouldn't be accessible anymore after a login (would always redirect)
670 switch ($redirMethod) {
671 case 'groupLogin':
672 // taken from dkd_redirect_at_login written by Ingmar Schlecht; database-field changed
673 $groupData = $this->frontendController->fe_user->groupData;
674 if (!empty($groupData['uid'])) {
675
676 // take the first group with a redirect page
677 $userGroupTable = $this->frontendController->fe_user->usergroup_table;
678 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($userGroupTable);
679 $queryBuilder->getRestrictions()->removeAll();
680 $row = $queryBuilder
681 ->select('felogin_redirectPid')
682 ->from($userGroupTable)
683 ->where(
684 $queryBuilder->expr()->neq(
685 'felogin_redirectPid',
686 $queryBuilder->createNamedParameter('', \PDO::PARAM_STR)
687 ),
688 $queryBuilder->expr()->in(
689 'uid',
690 $queryBuilder->createNamedParameter(
691 $groupData['uid'],
692 Connection::PARAM_INT_ARRAY
693 )
694 )
695 )
696 ->execute()
697 ->fetch();
698
699 if ($row) {
700 $redirect_url[] = $this->pi_getPageLink($row['felogin_redirectPid']);
701 }
702 }
703 break;
704 case 'userLogin':
705
706 $userTable = $this->frontendController->fe_user->user_table;
707 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($userTable);
708 $queryBuilder->getRestrictions()->removeAll();
709 $row = $queryBuilder
710 ->select('felogin_redirectPid')
711 ->from($userTable)
712 ->where(
713 $queryBuilder->expr()->neq(
714 'felogin_redirectPid',
715 $queryBuilder->createNamedParameter('', \PDO::PARAM_STR)
716 ),
717 $queryBuilder->expr()->eq(
718 $this->frontendController->fe_user->userid_column,
719 $queryBuilder->createNamedParameter(
720 $this->frontendController->fe_user->user['uid'],
721 \PDO::PARAM_INT
722 )
723 )
724 )
725 ->execute()
726 ->fetch();
727
728 if ($row) {
729 $redirect_url[] = $this->pi_getPageLink($row['felogin_redirectPid']);
730 }
731
732 break;
733 case 'login':
734 if ($this->conf['redirectPageLogin']) {
735 $redirect_url[] = $this->pi_getPageLink((int)$this->conf['redirectPageLogin']);
736 }
737 break;
738 case 'getpost':
739 $redirect_url[] = $this->redirectUrl;
740 break;
741 case 'referer':
742 // Avoid redirect when logging in after changing password
743 if ($this->piVars['redirectReferrer'] !== 'off') {
744 // Avoid forced logout, when trying to login immediately after a logout
745 $redirect_url[] = preg_replace('/[&?]logintype=[a-z]+/', '', $this->referer);
746 }
747 break;
748 case 'refererDomains':
749 // Auto redirect.
750 // Feature to redirect to the page where the user came from (HTTP_REFERER).
751 // Allowed domains to redirect to, can be configured with plugin.tx_felogin_pi1.domains
752 // Thanks to plan2.net / Martin Kutschker for implementing this feature.
753 // also avoid redirect when logging in after changing password
754 if (isset($this->conf['domains']) && $this->conf['domains']
755 && (!isset($this->piVars['redirectReferrer']) || $this->piVars['redirectReferrer'] !== 'off')
756 ) {
757 $url = $this->referer;
758 // Is referring url allowed to redirect?
759 $match = [];
760 if (preg_match('#^http://([[:alnum:]._-]+)/#', $url, $match)) {
761 $redirect_domain = $match[1];
762 $found = false;
763 foreach (GeneralUtility::trimExplode(',', $this->conf['domains'], true) as $d) {
764 if (preg_match('/(?:^|\\.)' . $d . '$/', $redirect_domain)) {
765 $found = true;
766 break;
767 }
768 }
769 if (!$found) {
770 $url = '';
771 }
772 }
773 // Avoid forced logout, when trying to login immediately after a logout
774 if ($url) {
775 $redirect_url[] = preg_replace('/[&?]logintype=[a-z]+/', '', $url);
776 }
777 }
778 break;
779 }
780 } elseif ($this->logintype === LoginType::LOGIN) {
781 // after login-error
782 switch ($redirMethod) {
783 case 'loginError':
784 if ($this->conf['redirectPageLoginError']) {
785 $redirect_url[] = $this->pi_getPageLink((int)$this->conf['redirectPageLoginError']);
786 }
787 break;
788 }
789 } elseif ($this->logintype == '' && $redirMethod === 'login' && $this->conf['redirectPageLogin']) {
790 // If login and page not accessible
791 $this->cObj->typoLink('', [
792 'parameter' => $this->conf['redirectPageLogin'],
793 'linkAccessRestrictedPages' => true
794 ]);
795 $redirect_url[] = $this->cObj->lastTypoLinkUrl;
796 } elseif ($this->logintype == '' && $redirMethod === 'logout' && $this->conf['redirectPageLogout'] && $this->userIsLoggedIn) {
797 // If logout and page not accessible
798 $redirect_url[] = $this->pi_getPageLink((int)$this->conf['redirectPageLogout']);
799 } elseif ($this->logintype === LoginType::LOGOUT) {
800 // after logout
801 // Hook for general actions after after logout has been confirmed
802 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['logout_confirmed'] ?? [] as $_funcRef) {
803 $_params = [];
804 if ($_funcRef) {
805 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
806 }
807 }
808 switch ($redirMethod) {
809 case 'logout':
810 if ($this->conf['redirectPageLogout']) {
811 $redirect_url[] = $this->pi_getPageLink((int)$this->conf['redirectPageLogout']);
812 }
813 break;
814 }
815 } else {
816 // not logged in
817 // Placeholder for maybe future options
818 switch ($redirMethod) {
819 case 'getpost':
820 // Preserve the get/post value
821 $redirect_url[] = $this->redirectUrl;
822 break;
823 }
824 }
825 }
826 }
827 // Remove empty values, but keep "0" as value (that's why "strlen" is used as second parameter)
828 if (!empty($redirect_url)) {
829 return array_filter($redirect_url, 'strlen');
830 }
831 return [];
832 }
833
834 /**
835 * Reads flexform configuration and merge it with $this->conf
836 */
837 protected function mergeflexFormValuesIntoConf()
838 {
839 $flex = [];
840 if ($this->flexFormValue('showForgotPassword', 'sDEF')) {
841 $flex['showForgotPasswordLink'] = $this->flexFormValue('showForgotPassword', 'sDEF');
842 }
843 if ($this->flexFormValue('showPermaLogin', 'sDEF')) {
844 $flex['showPermaLogin'] = $this->flexFormValue('showPermaLogin', 'sDEF');
845 }
846 if ($this->flexFormValue('showLogoutFormAfterLogin', 'sDEF')) {
847 $flex['showLogoutFormAfterLogin'] = $this->flexFormValue('showLogoutFormAfterLogin', 'sDEF');
848 }
849 if ($this->flexFormValue('pages', 'sDEF')) {
850 $flex['pages'] = $this->flexFormValue('pages', 'sDEF');
851 }
852 if ($this->flexFormValue('recursive', 'sDEF')) {
853 $flex['recursive'] = $this->flexFormValue('recursive', 'sDEF');
854 }
855 if ($this->flexFormValue('redirectMode', 's_redirect')) {
856 $flex['redirectMode'] = $this->flexFormValue('redirectMode', 's_redirect');
857 }
858 if ($this->flexFormValue('redirectFirstMethod', 's_redirect')) {
859 $flex['redirectFirstMethod'] = $this->flexFormValue('redirectFirstMethod', 's_redirect');
860 }
861 if ($this->flexFormValue('redirectDisable', 's_redirect')) {
862 $flex['redirectDisable'] = $this->flexFormValue('redirectDisable', 's_redirect');
863 }
864 if ($this->flexFormValue('redirectPageLogin', 's_redirect')) {
865 $flex['redirectPageLogin'] = $this->flexFormValue('redirectPageLogin', 's_redirect');
866 }
867 if ($this->flexFormValue('redirectPageLoginError', 's_redirect')) {
868 $flex['redirectPageLoginError'] = $this->flexFormValue('redirectPageLoginError', 's_redirect');
869 }
870 if ($this->flexFormValue('redirectPageLogout', 's_redirect')) {
871 $flex['redirectPageLogout'] = $this->flexFormValue('redirectPageLogout', 's_redirect');
872 }
873 $pid = $flex['pages'] ? $this->pi_getPidList($flex['pages'], $flex['recursive']) : 0;
874 if ($pid > 0) {
875 $flex['storagePid'] = $pid;
876 }
877 $this->conf = array_merge($this->conf, $flex);
878 }
879
880 /**
881 * Loads a variable from the flexform
882 *
883 * @param string $var Name of variable
884 * @param string $sheet Name of sheet
885 * @return string Value of var
886 */
887 protected function flexFormValue($var, $sheet)
888 {
889 return $this->pi_getFFvalue($this->cObj->data['pi_flexform'], $var, $sheet);
890 }
891
892 /**
893 * Generate link with typolink function
894 *
895 * @param string $label Linktext
896 * @param array $piVars Link vars
897 * @param bool $returnUrl TRUE: returns only url FALSE (default) returns the link)
898 * @return string Link or url
899 */
900 protected function getPageLink($label, $piVars, $returnUrl = false)
901 {
902 $additionalParams = '';
903 if (!empty($piVars)) {
904 foreach ($piVars as $key => $val) {
905 $additionalParams .= '&' . $key . '=' . $val;
906 }
907 }
908 // Should GETvars be preserved?
909 if ($this->conf['preserveGETvars']) {
910 $additionalParams .= $this->getPreserveGetVars();
911 }
912 $this->conf['linkConfig.']['parameter'] = $this->frontendController->id;
913 if ($additionalParams) {
914 $this->conf['linkConfig.']['additionalParams'] = $additionalParams;
915 }
916 if ($returnUrl) {
917 return htmlspecialchars($this->cObj->typoLink_URL($this->conf['linkConfig.']));
918 }
919 return $this->cObj->typoLink($label, $this->conf['linkConfig.']);
920 }
921
922 /**
923 * Add additional parameters for links according to TS setting preserveGETvars.
924 * Possible values are "all" or a comma separated list of allowed GET-vars.
925 * Supports multi-dimensional GET-vars.
926 * Some hardcoded values are dropped.
927 *
928 * @return string additionalParams-string
929 */
930 protected function getPreserveGetVars()
931 {
932 $getVars = GeneralUtility::_GET();
933 unset(
934 $getVars['id'],
935 $getVars['no_cache'],
936 $getVars['logintype'],
937 $getVars['redirect_url'],
938 $getVars['cHash'],
939 $getVars[$this->prefixId]
940 );
941 if ($this->conf['preserveGETvars'] === 'all') {
942 $preserveQueryParts = $getVars;
943 } else {
944 $preserveQueryStringProperties = GeneralUtility::trimExplode(',', $this->conf['preserveGETvars']);
945 $preserveQueryParts = [];
946 parse_str(implode('=1&', $preserveQueryStringProperties) . '=1', $preserveQueryParts);
947 $preserveQueryParts = \TYPO3\CMS\Core\Utility\ArrayUtility::intersectRecursive($getVars, $preserveQueryParts);
948 }
949 $parameters = GeneralUtility::implodeArrayForUrl('', $preserveQueryParts);
950 return $parameters;
951 }
952
953 /**
954 * Is used by forgot password - function with md5 option.
955 * @param int $len Length of new password
956 * @return string New password
957 */
958 protected function generatePassword($len)
959 {
960 $pass = '';
961 while ($len--) {
962 $char = rand(0, 35);
963 if ($char < 10) {
964 $pass .= '' . $char;
965 } else {
966 $pass .= chr($char - 10 + 97);
967 }
968 }
969 return $pass;
970 }
971
972 /**
973 * Returns the header / message value from flexform if present, else from locallang.xlf
974 *
975 * @param string $label label name
976 * @param array $stdWrapArray TS stdWrap array
977 * @return string label text
978 */
979 protected function getDisplayText($label, $stdWrapArray = [])
980 {
981 $text = $this->flexFormValue($label, 's_messages') ? $this->cObj->stdWrap($this->flexFormValue($label, 's_messages'), $stdWrapArray) : $this->cObj->stdWrap($this->pi_getLL('ll_' . $label), $stdWrapArray);
982 $replace = $this->getUserFieldMarkers();
983 return strtr($text, $replace);
984 }
985
986 /**
987 * Returns Array of markers filled with user fields
988 *
989 * @return array Marker array
990 */
991 protected function getUserFieldMarkers()
992 {
993 $marker = [];
994 // replace markers with fe_user data
995 if ($this->frontendController->fe_user->user) {
996 // All fields of fe_user will be replaced, scheme is ###FEUSER_FIELDNAME###
997 foreach ($this->frontendController->fe_user->user as $field => $value) {
998 $marker['###FEUSER_' . strtoupper($field) . '###'] = $this->cObj->stdWrap($value, $this->conf['userfields.'][$field . '.']);
999 }
1000 // Add ###USER### for compatibility
1001 $marker['###USER###'] = $marker['###FEUSER_USERNAME###'];
1002 }
1003 return $marker;
1004 }
1005
1006 /**
1007 * Returns a valid and XSS cleaned url for redirect, checked against configuration "allowedRedirectHosts"
1008 *
1009 * @param string $url
1010 * @return string cleaned referer or empty string if not valid
1011 */
1012 protected function validateRedirectUrl($url)
1013 {
1014 $url = strval($url);
1015 if ($url === '') {
1016 return '';
1017 }
1018 // Validate the URL:
1019 if ($this->isRelativeUrl($url) || $this->isInCurrentDomain($url) || $this->isInLocalDomain($url)) {
1020 return $url;
1021 }
1022 // URL is not allowed
1023 $this->logger->warning('Url "' . $url . '" for redirect was not accepted!');
1024 return '';
1025 }
1026
1027 /**
1028 * Determines whether the URL is on the current host and belongs to the
1029 * current TYPO3 installation. The scheme part is ignored in the comparison.
1030 *
1031 * @param string $url URL to be checked
1032 * @return bool Whether the URL belongs to the current TYPO3 installation
1033 */
1034 protected function isInCurrentDomain($url)
1035 {
1036 $urlWithoutSchema = preg_replace('#^https?://#', '', $url);
1037 $siteUrlWithoutSchema = preg_replace('#^https?://#', '', GeneralUtility::getIndpEnv('TYPO3_SITE_URL'));
1038 return strpos($urlWithoutSchema . '/', GeneralUtility::getIndpEnv('HTTP_HOST') . '/') === 0
1039 && strpos($urlWithoutSchema, $siteUrlWithoutSchema) === 0;
1040 }
1041
1042 /**
1043 * Determines whether the URL matches a domain
1044 * in the sys_domain database table.
1045 *
1046 * @param string $url Absolute URL which needs to be checked
1047 * @return bool Whether the URL is considered to be local
1048 */
1049 protected function isInLocalDomain($url)
1050 {
1051 $result = false;
1052 if (GeneralUtility::isValidUrl($url)) {
1053 $parsedUrl = parse_url($url);
1054 if ($parsedUrl['scheme'] === 'http' || $parsedUrl['scheme'] === 'https') {
1055 $host = $parsedUrl['host'];
1056 // Removes the last path segment and slash sequences like /// (if given):
1057 $path = preg_replace('#/+[^/]*$#', '', $parsedUrl['path'] ?? '');
1058
1059 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_domain');
1060 $queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
1061 $localDomains = $queryBuilder->select('domainName')
1062 ->from('sys_domain')
1063 ->execute()
1064 ->fetchAll();
1065
1066 if (is_array($localDomains)) {
1067 foreach ($localDomains as $localDomain) {
1068 // strip trailing slashes (if given)
1069 $domainName = rtrim($localDomain['domainName'], '/');
1070 if (GeneralUtility::isFirstPartOfStr($host . $path . '/', $domainName . '/')) {
1071 $result = true;
1072 break;
1073 }
1074 }
1075 }
1076 }
1077 }
1078 return $result;
1079 }
1080
1081 /**
1082 * Determines whether the URL is relative to the
1083 * current TYPO3 installation.
1084 *
1085 * @param string $url URL which needs to be checked
1086 * @return bool Whether the URL is considered to be relative
1087 */
1088 protected function isRelativeUrl($url)
1089 {
1090 $url = GeneralUtility::sanitizeLocalUrl($url);
1091 if (!empty($url)) {
1092 $parsedUrl = @parse_url($url);
1093 if ($parsedUrl !== false && !isset($parsedUrl['scheme']) && !isset($parsedUrl['host'])) {
1094 // If the relative URL starts with a slash, we need to check if it's within the current site path
1095 return $parsedUrl['path'][0] !== '/' || GeneralUtility::isFirstPartOfStr($parsedUrl['path'], GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'));
1096 }
1097 }
1098 return false;
1099 }
1100
1101 /**
1102 * Get TypoScriptFrontendController
1103 *
1104 * @return TypoScriptFrontendController
1105 */
1106 protected function getTypoScriptFrontendController()
1107 {
1108 return $GLOBALS['TSFE'];
1109 }
1110 }