Skip to content

Commit 2df7ea7

Browse files
Merge pull request #29752 from nextcloud/fix/allow-some-pages-without-two-factor
Explicitly allow access on some (public) routes also without 2FA
2 parents 69ab7b4 + c8caba2 commit 2df7ea7

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

core/Controller/OCJSController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public function __construct($appName,
9898

9999
/**
100100
* @NoCSRFRequired
101+
* @NoTwoFactorRequired
101102
* @PublicPage
102103
*
103104
* @return DataDisplayResponse

core/Middleware/TwoFactorMiddleware.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ public function __construct(Manager $twoFactorManager, Session $userSession, ISe
8383
* @param string $methodName
8484
*/
8585
public function beforeController($controller, $methodName) {
86+
if ($this->reflector->hasAnnotation('NoTwoFactorRequired')) {
87+
// Route handler explicitly marked to work without finished 2FA are
88+
// not blocked
89+
return;
90+
}
91+
8692
if ($controller instanceof APIController && $methodName === 'poll') {
8793
// Allow polling the twofactor nextcloud notifications state
8894
return;

0 commit comments

Comments
 (0)