2 namespace TYPO3\CMS\Backend\Controller;
114 $this->redirectToURL = $this->redirectUrl ?: BackendUtility::getModuleUrl(
'main');
122 $this->view = $this->getFluidTemplateObject();
135 $content = $this->main();
136 $response->
getBody()->write($content);
146 public function main()
150 $pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Backend/Login');
154 if ($clientInfo[
'BROWSER'] ===
'msie' && $clientInfo[
'VERSION'] <= 9) {
155 $pageRenderer->addJsLibrary(
'placeholders',
'sysext/core/Resources/Public/JavaScript/Contrib/placeholders.jquery.min.js');
163 $extConf = unserialize(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXT'][
'extConf'][
'backend']);
166 if (!empty(
$extConf[
'loginBackgroundImage'])) {
169 @media (min-width: 768px){
170 .typo3-login-carousel-control.right,
171 .typo3-login-carousel-control.left,
172 .panel-login { border: 0; }
173 .typo3-login { background-image: url("' . $backgroundImage .
'"); }
179 if (!empty(
$extConf[
'loginHighlightColor'])) {
181 .btn-login.disabled, .btn-login[disabled], fieldset[disabled] .btn-login,
182 .btn-login.disabled:hover, .btn-login[disabled]:hover, fieldset[disabled] .btn-login:hover,
183 .btn-login.disabled:focus, .btn-login[disabled]:focus, fieldset[disabled] .btn-login:focus,
184 .btn-login.disabled.focus, .btn-login[disabled].focus, fieldset[disabled] .btn-login.focus,
185 .btn-login.disabled:active, .btn-login[disabled]:active, fieldset[disabled] .btn-login:active,
186 .btn-login.disabled.active, .btn-login[disabled].active, fieldset[disabled] .btn-login.active,
187 .btn-login:hover, .btn-login:focus, .btn-login:active,
188 .btn-login:active:hover, .btn-login:active:focus,
189 .btn-login { background-color: ' .
$extConf[
'loginHighlightColor'] .
'; }
190 .panel-login .panel-body { border-color: ' .
$extConf[
'loginHighlightColor'] .
'; }
195 if (!empty(
$extConf[
'loginLogo'])) {
199 $logo =
$GLOBALS[
'TBE_STYLES'][
'logo_login'];
200 GeneralUtility::deprecationLog(
'$GLOBALS["TBE_STYLES"]["logo_login"] is deprecated since TYPO3 CMS 7 and will be removed in TYPO3 CMS 8, please use the backend extension\'s configuration instead.');
203 if (!empty(
$extConf[
'loginHighlightColor'])) {
204 $logo =
'EXT:backend/Resources/Public/Images/typo3_black.svg';
206 $logo =
'EXT:backend/Resources/Public/Images/typo3_orange.svg';
209 .typo3-login-logo .typo3-login-image { max-width: 150px; }
216 $this->view->assignMultiple(array(
219 'formType' => $formType,
222 'capslock' => $this->
getUriForFileName(
'EXT:backend/Resources/Public/Images/icon_capslock.svg'),
223 'typo3' => $this->
getUriForFileName(
'EXT:backend/Resources/Public/Images/typo3_orange.svg'),
227 'loginProviderIdentifier' => $this->loginProviderIdentifier,
228 'loginProviders' => $this->loginProviders
236 $loginProvider->render($this->view, $pageRenderer, $this);
239 $content .= $this->view->render();
272 if ($this->submitValue ===
'setCookie') {
278 throw new \RuntimeException(
'Login-error: Yeah, that\'s a classic. No cookies, no TYPO3. ' .
279 'Please accept cookies from TYPO3 - otherwise you\'ll not be able to use the system.', 1294586846);
282 $this->redirectToURL =
'index.php?commandLI=setCookie';
286 if (empty($redirectToUrl)) {
290 $interface =
'frontend';
291 $this->redirectToURL =
'../';
294 $interface =
'backend';
295 $this->redirectToURL = BackendUtility::getModuleUrl(
'main');
301 $this->redirectToURL = $redirectToUrl;
310 throw new \RuntimeException(
'The Form Protection retrieved does not match the expected one.', 1432080411);
312 if ($this->loginRefresh) {
313 $formProtection->setSessionTokenFromRegistry();
314 $formProtection->persistSessionToken();
316 if (parent.opener && parent.opener.TYPO3 && parent.opener.TYPO3.LoginRefresh) {
317 parent.opener.TYPO3.LoginRefresh.startTask();
322 $formProtection->storeSessionTokenInRegistry();
337 if (count($parts) > 1) {
342 'jumpScript' => BackendUtility::getModuleUrl(
'main'),
343 'interface' =>
'backend'
347 'jumpScript' =>
'../',
348 'interface' =>
'frontend'
352 $this->view->assign(
'showInterfaceSelector',
true);
353 $this->view->assign(
'interfaces', $interfaces);
354 }
elseif (!$this->redirectUrl) {
356 $this->view->assign(
'showInterfaceSelector',
false);
357 $this->view->assign(
'interface', $parts[0]);
370 $systemNewsTable =
'sys_news';
371 $systemNews = array();
373 foreach ($systemNewsRecords as $systemNewsRecord) {
374 $systemNews[] = array(
375 'date' => date(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'ddmmyy'], $systemNewsRecord[
'crdate']),
376 'header' => $systemNewsRecord[
'title'],
377 'content' => $systemNewsRecord[
'content']
401 if ($absoluteFilename !==
'') {
418 return !empty($username) || !empty($this->submitValue);
426 protected function getFluidTemplateObject()
434 $view->getRequest()->setControllerExtensionName(
'Backend');
446 !isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'backend'][
'loginProviders'])
447 || !is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'backend'][
'loginProviders'])
448 || empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'backend'][
'loginProviders'])
450 throw new \RuntimeException(
'No login providers are registered in $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'backend\'][\'loginProviders\'].', 1433417281);
452 $providers =
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'backend'][
'loginProviders'];
453 foreach ($providers as $identifier => $configuration) {
454 if (empty($configuration) || !is_array($configuration)) {
455 throw new \RuntimeException(
'Missing configuration for login provider "' . $identifier .
'".', 1433416043);
457 if (!is_string($configuration[
'provider']) || empty($configuration[
'provider']) || !class_exists($configuration[
'provider']) || !is_subclass_of($configuration[
'provider'], LoginProviderInterface::class)) {
458 throw new \RuntimeException(
'The login provider "' . $identifier .
'" defines an invalid provider. Ensure the class exists and implements the "' . LoginProviderInterface::class .
'".', 1433416043);
460 if (empty($configuration[
'label'])) {
461 throw new \RuntimeException(
'Missing label definition for login provider "' . $identifier .
'".', 1433416044);
463 if (empty($configuration[
'icon-class'])) {
464 throw new \RuntimeException(
'Missing icon definition for login provider "' . $identifier .
'".', 1433416045);
466 if (!isset($configuration[
'sorting'])) {
467 throw new \RuntimeException(
'Missing sorting definition for login provider "' . $identifier .
'".', 1433416046);
471 uasort($providers,
function ($a, $b) {
472 return $b[
'sorting'] - $a[
'sorting'];
474 $this->loginProviders = $providers;
486 if ((empty($loginProvider) || !isset($this->loginProviders[$loginProvider])) && !empty($_COOKIE[
'be_lastLoginProvider'])) {
487 $loginProvider = $_COOKIE[
'be_lastLoginProvider'];
489 if (empty($loginProvider) || !isset($this->loginProviders[$loginProvider])) {
490 reset($this->loginProviders);
491 $loginProvider = key($this->loginProviders);
493 setcookie(
'be_lastLoginProvider', $loginProvider,
$GLOBALS[
'EXEC_TIME'] + 7776000);
494 return $loginProvider;