From b9fe00aa96aab48d7f7e7914c100a668afbd10ba Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 4 Oct 2021 09:54:58 +0200 Subject: [PATCH] Allow "TwoFactor Nextcloud Notifications" to pull the state of the 2FA again Signed-off-by: Joas Schilling --- core/Middleware/TwoFactorMiddleware.php | 6 ++++++ psalm.xml | 1 + 2 files changed, 7 insertions(+) diff --git a/core/Middleware/TwoFactorMiddleware.php b/core/Middleware/TwoFactorMiddleware.php index d5a8a2f877a..c0e01cbe033 100644 --- a/core/Middleware/TwoFactorMiddleware.php +++ b/core/Middleware/TwoFactorMiddleware.php @@ -32,6 +32,7 @@ use OC\Authentication\TwoFactorAuth\Manager; use OC\Core\Controller\LoginController; use OC\Core\Controller\TwoFactorChallengeController; use OC\User\Session; +use OCA\TwoFactorNextcloudNotification\Controller\APIController; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Middleware; @@ -83,6 +84,11 @@ class TwoFactorMiddleware extends Middleware { * @param string $methodName */ public function beforeController($controller, $methodName) { + if ($controller instanceof APIController && $methodName === 'poll') { + // Allow polling the twofactor nextcloud notifications state + return; + } + if ($controller instanceof TwoFactorChallengeController && $this->userSession->getUser() !== null && !$this->reflector->hasAnnotation('TwoFactorSetUpDoneRequired')) { diff --git a/psalm.xml b/psalm.xml index 2858b448904..77a032a2346 100644 --- a/psalm.xml +++ b/psalm.xml @@ -49,6 +49,7 @@ +