From 2f36920ddf019c5fcd38420acf9e570d4c1ac267 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Mon, 28 Nov 2016 08:47:34 +0100 Subject: [PATCH] fix undefined index error when the backup codes provider is not active 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 --- lib/private/Authentication/TwoFactorAuth/Manager.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php index d84ba4aee7e..48792aa685b 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -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]; } -- 2.39.5