[BUGFIX] Allow direct access to BE again while being logged in 49/56949/6
authorMarkus Klein <markus.klein@typo3.org>
Sat, 12 May 2018 21:16:19 +0000 (23:16 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 13 May 2018 07:47:32 +0000 (09:47 +0200)
Having a valid backend authentication and accessing /typo3
now redirects to the backend view again.

Resolves: #84991
Releases: master
Change-Id: I483f6408192a7a239144868048476057ca5b282c
Reviewed-on: https://review.typo3.org/56949
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Wolf <andreas.wolf@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Controller/LoginController.php
typo3/sysext/backend/Tests/Unit/Controller/LoginControllerTest.php

index 3b60c1c..782cc2f 100644 (file)
@@ -300,22 +300,16 @@ class LoginController implements LoggerAwareInterface
     /**
      * Checking, if we should perform some sort of redirection OR closing of windows.
      *
-     * Do redirect:
-     *
-     * If a user is logged in AND
-     *   a) if either the login is just done (isLoginInProgress) or
-     *   b) a loginRefresh is done
+     * Do a redirect if a user is logged in
      *
      * @param ServerRequestInterface $request
      * @throws \RuntimeException
      * @throws \UnexpectedValueException
+     * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
      */
     protected function checkRedirect(ServerRequestInterface $request): void
     {
-        if (
-            empty($this->getBackendUserAuthentication()->user['uid']) ||
-            (!($this->isLoginInProgress($request) || $this->loginRefresh))
-        ) {
+        if (empty($this->getBackendUserAuthentication()->user['uid'])) {
             return;
         }
 
index 075571d..06d42d8 100644 (file)
@@ -273,28 +273,6 @@ class LoginControllerTest extends UnitTestCase
     }
 
     /**
-     * @test
-     */
-    public function checkRedirectDoesNotRedirectIfLoginIsNotInProgressAndLoginRefreshIsFalse(): void
-    {
-        $GLOBALS['BE_USER'] = $this->prophesize(BackendUserAuthentication::class)->reveal();
-        $this->loginControllerMock = $this->getAccessibleMock(
-            LoginController::class,
-            ['redirectToUrl', 'isLoginInProgress'],
-            [],
-            '',
-            false
-        );
-
-        $GLOBALS['BE_USER']->user['uid'] = 1;
-        $this->loginControllerMock->method('isLoginInProgress')->willReturn(false);
-        $this->loginControllerMock->_set('loginRefresh', false);
-
-        $this->loginControllerMock->expects($this->never())->method('redirectToUrl');
-        $this->loginControllerMock->_call('checkRedirect', $this->prophesize(ServerRequest::class)->reveal());
-    }
-
-    /**
      * FormProtectionFactory has an internal static instance cache we need to work around here
      */
     protected function prophesizeFormProtection(): void