summaryrefslogtreecommitdiffstats
path: root/apps/twofactor_backupcodes
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-04-12 13:44:23 +0200
committerJoas Schilling <coding@schilljs.com>2019-07-15 15:12:43 +0200
commita386ecec8c75677942f489e9e94ddcca6a29a05e (patch)
tree539e400d4c840099d38bceb9ab632bcc9e86ef51 /apps/twofactor_backupcodes
parentf376b9fea7ba02fb3087ba2fb403c481a7053340 (diff)
downloadnextcloud-server-a386ecec8c75677942f489e9e94ddcca6a29a05e.tar.gz
nextcloud-server-a386ecec8c75677942f489e9e94ddcca6a29a05e.zip
Update twofactor_backupcodes Notifier
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/twofactor_backupcodes')
-rw-r--r--apps/twofactor_backupcodes/lib/AppInfo/Application.php10
-rw-r--r--apps/twofactor_backupcodes/lib/Notifications/Notifier.php23
2 files changed, 22 insertions, 11 deletions
diff --git a/apps/twofactor_backupcodes/lib/AppInfo/Application.php b/apps/twofactor_backupcodes/lib/AppInfo/Application.php
index 041af037067..c4e02aaa261 100644
--- a/apps/twofactor_backupcodes/lib/AppInfo/Application.php
+++ b/apps/twofactor_backupcodes/lib/AppInfo/Application.php
@@ -74,15 +74,7 @@ class Application extends App {
$container = $this->getContainer();
/** @var IManager $manager */
$manager = $container->query(IManager::class);
- $manager->registerNotifier(
- function() use ($container) {
- return $container->query(Notifier::class);
- },
- function () use ($container) {
- $l = $container->query(IL10N::class);
- return ['id' => 'twofactor_backupcodes', 'name' => $l->t('Second-factor backup codes')];
- }
- );
+ $manager->registerNotifier(Notifier::class);
}
public function deleteUser($params) {
diff --git a/apps/twofactor_backupcodes/lib/Notifications/Notifier.php b/apps/twofactor_backupcodes/lib/Notifications/Notifier.php
index df92c7a9e01..5e53a32df77 100644
--- a/apps/twofactor_backupcodes/lib/Notifications/Notifier.php
+++ b/apps/twofactor_backupcodes/lib/Notifications/Notifier.php
@@ -42,7 +42,27 @@ class Notifier implements INotifier {
$this->url = $url;
}
- public function prepare(INotification $notification, $languageCode) {
+ /**
+ * Identifier of the notifier, only use [a-z0-9_]
+ *
+ * @return string
+ * @since 17.0.0
+ */
+ public function getID(): string {
+ return 'twofactor_backupcodes';
+ }
+
+ /**
+ * Human readable name describing the notifier
+ *
+ * @return string
+ * @since 17.0.0
+ */
+ public function getName(): string {
+ return $this->factory->get('twofactor_backupcodes')->t('Second-factor backup codes');
+ }
+
+ public function prepare(INotification $notification, string $languageCode): INotification {
if ($notification->getApp() !== 'twofactor_backupcodes') {
// Not my app => throw
throw new \InvalidArgumentException();
@@ -67,5 +87,4 @@ class Notifier implements INotifier {
throw new \InvalidArgumentException();
}
}
-
}