diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2016-11-28 08:47:34 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2016-11-28 08:48:57 +0100 |
commit | 2f36920ddf019c5fcd38420acf9e570d4c1ac267 (patch) | |
tree | e5d0956639eae4a1dffefbf118b8d6b692a69d64 /lib/private/Authentication/TwoFactorAuth/Manager.php | |
parent | 4e682d41136f658a316352a353d3d4611e95bca7 (diff) | |
download | nextcloud-server-2f36920ddf019c5fcd38420acf9e570d4c1ac267.tar.gz nextcloud-server-2f36920ddf019c5fcd38420acf9e570d4c1ac267.zip |
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 <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Authentication/TwoFactorAuth/Manager.php')
-rw-r--r-- | lib/private/Authentication/TwoFactorAuth/Manager.php | 3 |
1 files changed, 3 insertions, 0 deletions
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]; } |