Merge pull request #29765 from nextcloud/backport/29752/stable20

[stable20] Explicitly allow some routes without 2FA
pull/31250/head
blizzz 2 years ago committed by GitHub
commit 287797307d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -99,6 +99,7 @@ class OCJSController extends Controller {
/**
* @NoCSRFRequired
* @NoTwoFactorRequired
* @PublicPage
*
* @return DataDisplayResponse

@ -84,6 +84,12 @@ class TwoFactorMiddleware extends Middleware {
* @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;

Loading…
Cancel
Save