Merge pull request #29752 from nextcloud/fix/allow-some-pages-without-two-factor

Explicitly allow access on some (public) routes also without 2FA
This commit is contained in:
Joas Schilling 2021-11-18 10:43:28 +01:00 committed by GitHub
commit 2df7ea7dae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

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

View file

@ -83,6 +83,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;