]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix undefined index error when the backup codes provider is not active 2361/head
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Mon, 28 Nov 2016 07:47:34 +0000 (08:47 +0100)
committerChristoph Wurst <christoph@winzerhof-wurst.at>
Mon, 28 Nov 2016 07:48:57 +0000 (08:48 +0100)
In users have not created backup codes yet the app is not enabled for that user
and therefore we got an undefined index error because the code assumed it was
always there. It now properly returns null.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
lib/private/Authentication/TwoFactorAuth/Manager.php

index d84ba4aee7ecfb3662c1a6f01d661a0239709387..48792aa685b1efc5f0c648742cc5fea4125e36e2 100644 (file)
@@ -106,6 +106,9 @@ class Manager {
         */
        public function getBackupProvider(IUser $user) {
                $providers = $this->getProviders($user, true);
+               if (!isset($providers[self::BACKUP_CODES_PROVIDER_ID])) {
+                       return null;
+               }
                return $providers[self::BACKUP_CODES_PROVIDER_ID];
        }