diff options
Diffstat (limited to 'lib/private/Authentication/TwoFactorAuth/Manager.php')
-rw-r--r-- | lib/private/Authentication/TwoFactorAuth/Manager.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php index 2b2924e7f14..6ca4fd065a6 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -21,8 +21,10 @@ namespace OC\Authentication\TwoFactorAuth; +use Exception; use OC; use OC\App\AppManager; +use OC_App; use OCP\AppFramework\QueryException; use OCP\Authentication\TwoFactorAuth\IProvider; use OCP\IConfig; @@ -109,10 +111,12 @@ class Manager { $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, ignore it + // Provider class can not be resolved + throw new Exception("Could not load two-factor auth provider $class"); } } } @@ -124,6 +128,17 @@ class Manager { } /** + * Load an app by ID if it has not been loaded yet + * + * @param string $appId + */ + protected function loadTwoFactorApp($appId) { + if (!OC_App::isAppLoaded($appId)) { + OC_App::loadApp($appId); + } + } + + /** * Verify the given challenge * * @param string $providerId |