From 2220b3f7db4921b6dba6243f679c5dbd7a404a64 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Wed, 21 Jul 2021 09:58:17 +0200 Subject: Improve provider check Check if there is a provider missing. Signed-off-by: Lukas Reschke --- core/Middleware/TwoFactorMiddleware.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'core/Middleware') diff --git a/core/Middleware/TwoFactorMiddleware.php b/core/Middleware/TwoFactorMiddleware.php index fb856ce8938..288a5305359 100644 --- a/core/Middleware/TwoFactorMiddleware.php +++ b/core/Middleware/TwoFactorMiddleware.php @@ -101,7 +101,11 @@ class TwoFactorMiddleware extends Middleware { if ($controller instanceof ALoginSetupController && $this->userSession->getUser() !== null && $this->twoFactorManager->needsSecondFactor($this->userSession->getUser())) { - return; + $providers = $this->twoFactorManager->getProviderSet($this->userSession->getUser()); + + if ($providers->getProviders() === [] && !$providers->isProviderMissing()) { + return; + } } if ($controller instanceof LoginController && $methodName === 'logout') { -- cgit v1.2.3