diff --git a/core/Controller/OCJSController.php b/core/Controller/OCJSController.php index c3a74733b98e0..9a4991ddd3e28 100644 --- a/core/Controller/OCJSController.php +++ b/core/Controller/OCJSController.php @@ -99,6 +99,7 @@ public function __construct($appName, /** * @NoCSRFRequired + * @NoTwoFactorRequired * @PublicPage * * @return DataDisplayResponse diff --git a/core/Middleware/TwoFactorMiddleware.php b/core/Middleware/TwoFactorMiddleware.php index c0e01cbe03370..a6c8a131cee33 100644 --- a/core/Middleware/TwoFactorMiddleware.php +++ b/core/Middleware/TwoFactorMiddleware.php @@ -84,6 +84,12 @@ public function __construct(Manager $twoFactorManager, Session $userSession, ISe * @param string $methodName */ public function beforeController($controller, $methodName) { + if ($this->reflector->hasAnnotation('NoTwoFactorRequired')) { + // Route handler explicitly marked to work without finished 2FA are + // not blocked + return; + } + if ($controller instanceof APIController && $methodName === 'poll') { // Allow polling the twofactor nextcloud notifications state return;