diff options
-rw-r--r-- | core/Middleware/TwoFactorMiddleware.php | 5 | ||||
-rw-r--r-- | tests/Core/Middleware/TwoFactorMiddlewareTest.php | 27 |
2 files changed, 0 insertions, 32 deletions
diff --git a/core/Middleware/TwoFactorMiddleware.php b/core/Middleware/TwoFactorMiddleware.php index 398234fa1e4..2ddfcafa027 100644 --- a/core/Middleware/TwoFactorMiddleware.php +++ b/core/Middleware/TwoFactorMiddleware.php @@ -82,11 +82,6 @@ class TwoFactorMiddleware extends Middleware { * @param string $methodName */ public function beforeController($controller, $methodName) { - if ($this->reflector->hasAnnotation('PublicPage')) { - // Don't block public pages - return; - } - if ($controller instanceof TwoFactorChallengeController && $this->userSession->getUser() !== null && !$this->reflector->hasAnnotation('TwoFactorSetUpDoneRequired')) { diff --git a/tests/Core/Middleware/TwoFactorMiddlewareTest.php b/tests/Core/Middleware/TwoFactorMiddlewareTest.php index 5ef2b75fde6..8cc4340ad98 100644 --- a/tests/Core/Middleware/TwoFactorMiddlewareTest.php +++ b/tests/Core/Middleware/TwoFactorMiddlewareTest.php @@ -97,10 +97,6 @@ class TwoFactorMiddlewareTest extends TestCase { } public function testBeforeControllerNotLoggedIn() { - $this->reflector->expects($this->once()) - ->method('hasAnnotation') - ->with('PublicPage') - ->willReturn(false); $this->userSession->expects($this->once()) ->method('isLoggedIn') ->willReturn(false); @@ -111,24 +107,9 @@ class TwoFactorMiddlewareTest extends TestCase { $this->middleware->beforeController($this->controller, 'index'); } - public function testBeforeControllerPublicPage() { - $this->reflector->expects($this->once()) - ->method('hasAnnotation') - ->with('PublicPage') - ->willReturn(true); - $this->userSession->expects($this->never()) - ->method('isLoggedIn'); - - $this->middleware->beforeController($this->controller, 'create'); - } - public function testBeforeSetupController() { $user = $this->createMock(IUser::class); $controller = $this->createMock(ALoginSetupController::class); - $this->reflector->expects($this->once()) - ->method('hasAnnotation') - ->with('PublicPage') - ->willReturn(false); $this->userSession->expects($this->any()) ->method('getUser') ->willReturn($user); @@ -144,10 +125,6 @@ class TwoFactorMiddlewareTest extends TestCase { public function testBeforeControllerNoTwoFactorCheckNeeded() { $user = $this->createMock(IUser::class); - $this->reflector->expects($this->once()) - ->method('hasAnnotation') - ->with('PublicPage') - ->willReturn(false); $this->userSession->expects($this->once()) ->method('isLoggedIn') ->willReturn(true); @@ -168,10 +145,6 @@ class TwoFactorMiddlewareTest extends TestCase { $user = $this->createMock(IUser::class); - $this->reflector->expects($this->once()) - ->method('hasAnnotation') - ->with('PublicPage') - ->willReturn(false); $this->userSession->expects($this->once()) ->method('isLoggedIn') ->willReturn(true); |