Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions core/Middleware/TwoFactorMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ public function __construct(Manager $twoFactorManager, Session $userSession, ISe
* @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')) {
Expand Down
27 changes: 0 additions & 27 deletions tests/Core/Middleware/TwoFactorMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ protected function setUp(): void {
}

public function testBeforeControllerNotLoggedIn() {
$this->reflector->expects($this->once())
->method('hasAnnotation')
->with('PublicPage')
->willReturn(false);
$this->userSession->expects($this->once())
->method('isLoggedIn')
->willReturn(false);
Expand All @@ -111,24 +107,9 @@ public function testBeforeControllerNotLoggedIn() {
$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);
Expand All @@ -144,10 +125,6 @@ public function testBeforeSetupController() {
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);
Expand All @@ -168,10 +145,6 @@ public function testBeforeControllerTwoFactorAuthRequired() {

$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);
Expand Down