diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2018-08-09 12:27:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-09 12:27:29 +0200 |
commit | 0757c5298035eebb1b304bff1f1bc2025aa2bf91 (patch) | |
tree | e4a8958445ad1a6219f7812624d33a20dadc9e52 /lib | |
parent | def2bf2086b00b5bb00b362a5a50840fdf8b4cc0 (diff) | |
parent | d8197f2b971f8ed0fb2e4ed0ad7bf498e5bfb66c (diff) | |
download | nextcloud-server-0757c5298035eebb1b304bff1f1bc2025aa2bf91.tar.gz nextcloud-server-0757c5298035eebb1b304bff1f1bc2025aa2bf91.zip |
Merge pull request #10588 from nextcloud/fix/single-2fa-provider-login-redirect
Fix login redirection if only one 2FA provider is active
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Authentication/TwoFactorAuth/ProviderSet.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/private/Authentication/TwoFactorAuth/ProviderSet.php b/lib/private/Authentication/TwoFactorAuth/ProviderSet.php index bbb9467798b..91a00a0bf8e 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 getPrimaryProviders(): array { + return array_filter($this->providers, function(IProvider $provider) { + return !($provider instanceof BackupCodesProvider); + }); + } + public function isProviderMissing(): bool { return $this->providerMissing; } |