From c6e47e8a5139cccdd51a6c68e112e28b73adaddd Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 8 Aug 2018 15:25:59 +0200 Subject: Fix login redirection if only one 2FA provider is active Fixes https://github.com/nextcloud/server/issues/10500. Signed-off-by: Christoph Wurst --- lib/private/Authentication/TwoFactorAuth/ProviderSet.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/private/Authentication') diff --git a/lib/private/Authentication/TwoFactorAuth/ProviderSet.php b/lib/private/Authentication/TwoFactorAuth/ProviderSet.php index bbb9467798b..63012d9ab55 100644 --- a/lib/private/Authentication/TwoFactorAuth/ProviderSet.php +++ b/lib/private/Authentication/TwoFactorAuth/ProviderSet.php @@ -25,6 +25,8 @@ declare(strict_types=1); namespace OC\Authentication\TwoFactorAuth; +use function array_filter; +use OCA\TwoFactorBackupCodes\Provider\BackupCodesProvider; use OCP\Authentication\TwoFactorAuth\IProvider; /** @@ -65,6 +67,15 @@ class ProviderSet { return $this->providers; } + /** + * @return IProvider[] + */ + public function get3rdPartyProviders(): array { + return array_filter($this->providers, function(IProvider $provider) { + return !($provider instanceof BackupCodesProvider); + }); + } + public function isProviderMissing(): bool { return $this->providerMissing; } -- cgit v1.2.3