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
Explicitly allow some routes without 2FA
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst authored and blizzz committed Nov 18, 2021
commit c49d49c4b06e4537d4050f7c3be917e6fcb99731
1 change: 1 addition & 0 deletions core/Controller/OCJSController.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public function __construct($appName,

/**
* @NoCSRFRequired
* @NoTwoFactorRequired
* @PublicPage
*
* @return DataDisplayResponse
Expand Down
6 changes: 6 additions & 0 deletions core/Middleware/TwoFactorMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,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;
Expand Down