From 681ac9f19ff023da917da5a6f34cb1dadfb6dfb1 Mon Sep 17 00:00:00 2001
From: Robin Appelman <robin@icewind.nl>
Date: Sat, 23 Jul 2016 13:26:57 +0200
Subject: [PATCH] Check if an app provide two-factor-auth providers before we
 try to use them

---
 .../Authentication/TwoFactorAuth/Manager.php  | 20 ++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php
index bca75263a71..66bcafbce71 100644
--- a/lib/private/Authentication/TwoFactorAuth/Manager.php
+++ b/lib/private/Authentication/TwoFactorAuth/Manager.php
@@ -109,15 +109,17 @@ class Manager {
 
 		foreach ($allApps as $appId) {
 			$info = $this->appManager->getAppInfo($appId);
-			$providerClasses = $info['two-factor-providers'];
-			foreach ($providerClasses as $class) {
-				try {
-					$this->loadTwoFactorApp($appId);
-					$provider = OC::$server->query($class);
-					$providers[$provider->getId()] = $provider;
-				} catch (QueryException $exc) {
-					// Provider class can not be resolved
-					throw new Exception("Could not load two-factor auth provider $class");
+			if (isset($info['two-factor-providers'])) {
+				$providerClasses = $info['two-factor-providers'];
+				foreach ($providerClasses as $class) {
+					try {
+						$this->loadTwoFactorApp($appId);
+						$provider = OC::$server->query($class);
+						$providers[$provider->getId()] = $provider;
+					} catch (QueryException $exc) {
+						// Provider class can not be resolved
+						throw new Exception("Could not load two-factor auth provider $class");
+					}
 				}
 			}
 		}
-- 
GitLab