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>
This commit is contained in:
Christoph Wurst 2016-11-28 08:47:34 +01:00
parent 4e682d4113
commit 2f36920ddf

View 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];
}