diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2016-12-13 15:15:14 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2016-12-19 11:59:48 +0100 |
commit | ed4017dfb4d605943988c6686b088b41d1680110 (patch) | |
tree | c50d57d247c46b20e514f10f3b381820c2578b4f /apps/twofactor_backupcodes/lib | |
parent | 93003120461648140ee244b345cfcb6690071faa (diff) | |
download | nextcloud-server-ed4017dfb4d605943988c6686b088b41d1680110.tar.gz nextcloud-server-ed4017dfb4d605943988c6686b088b41d1680110.zip |
fix minor issues
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/twofactor_backupcodes/lib')
3 files changed, 18 insertions, 6 deletions
diff --git a/apps/twofactor_backupcodes/lib/Activity/GenericFilter.php b/apps/twofactor_backupcodes/lib/Activity/GenericFilter.php index f2b0ef6f23f..27c0274b600 100644 --- a/apps/twofactor_backupcodes/lib/Activity/GenericFilter.php +++ b/apps/twofactor_backupcodes/lib/Activity/GenericFilter.php @@ -40,7 +40,7 @@ class GenericFilter implements IFilter { } public function allowedApps() { - return null; + return []; } public function filterTypes(array $types) { diff --git a/apps/twofactor_backupcodes/lib/Activity/Provider.php b/apps/twofactor_backupcodes/lib/Activity/Provider.php index db139a0e674..cfb16c9f8d3 100644 --- a/apps/twofactor_backupcodes/lib/Activity/Provider.php +++ b/apps/twofactor_backupcodes/lib/Activity/Provider.php @@ -55,7 +55,7 @@ class Provider implements IProvider { switch ($event->getSubject()) { case 'codes_generated': - $event->setParsedSubject($l->t('You created backup codes for your account')); + $event->setParsedSubject($l->t('You created two-factor backup codes for your account')); $event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg'))); break; default: diff --git a/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php b/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php index d7bcfe01475..d9f75fa5a33 100644 --- a/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php +++ b/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php @@ -22,9 +22,11 @@ namespace OCA\TwoFactorBackupCodes\Service; +use Exception; use OCA\TwoFactorBackupCodes\Db\BackupCode; use OCA\TwoFactorBackupCodes\Db\BackupCodeMapper; use OCP\Activity\IManager; +use OCP\ILogger; use OCP\IUser; use OCP\Security\IHasher; use OCP\Security\ISecureRandom; @@ -43,11 +45,16 @@ class BackupCodeStorage { /** @var IManager */ private $activityManager; - public function __construct(BackupCodeMapper $mapper, ISecureRandom $random, IHasher $hasher, IManager $activityManager) { + /** @var ILogger */ + private $logger; + + public function __construct(BackupCodeMapper $mapper, ISecureRandom $random, IHasher $hasher, + IManager $activityManager, ILogger $logger) { $this->mapper = $mapper; $this->hasher = $hasher; $this->random = $random; $this->activityManager = $activityManager; + $this->logger = $logger; } /** @@ -89,9 +96,14 @@ class BackupCodeStorage { $activity->setApp('twofactor_backupcodes') ->setType('twofactor') ->setAuthor($user->getUID()) - ->setAffectedUser($user->getUID()); - $activity->setSubject($event); - $this->activityManager->publish($activity); + ->setAffectedUser($user->getUID()) + ->setSubject($event); + try { + $this->activityManager->publish($activity); + } catch (Exception $e) { + $this->logger->warning('could not publish backup code creation activity', ['app' => 'twofactor_backupcodes']); + $this->logger->logException($e, ['app' => 'twofactor_backupcodes']); + } } /** |