Skip to content

Commit d0c5a24

Browse files
Merge pull request #29764 from nextcloud/backport/29752/stable21
[stable21] Explicitly allow some routes without 2FA
2 parents 28f41da + fc5b490 commit d0c5a24

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
@@ -99,6 +99,7 @@ public function __construct($appName,
9999

100100
/**
101101
* @NoCSRFRequired
102+
* @NoTwoFactorRequired
102103
* @PublicPage
103104
*
104105
* @return DataDisplayResponse

core/Middleware/TwoFactorMiddleware.php

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

0 commit comments

Comments
 (0)