@@ -31,44 +31,44 @@ |
||
| 31 | 31 | |
| 32 | 32 | class Notifier implements INotifier { |
| 33 | 33 | |
| 34 | - /** @var IFactory */ |
|
| 35 | - private $factory; |
|
| 34 | + /** @var IFactory */ |
|
| 35 | + private $factory; |
|
| 36 | 36 | |
| 37 | - /** @var IURLGenerator */ |
|
| 38 | - private $url; |
|
| 37 | + /** @var IURLGenerator */ |
|
| 38 | + private $url; |
|
| 39 | 39 | |
| 40 | - public function __construct(IFactory $factory, IURLGenerator $url) { |
|
| 41 | - $this->factory = $factory; |
|
| 42 | - $this->url = $url; |
|
| 43 | - } |
|
| 40 | + public function __construct(IFactory $factory, IURLGenerator $url) { |
|
| 41 | + $this->factory = $factory; |
|
| 42 | + $this->url = $url; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public function prepare(INotification $notification, $languageCode) { |
|
| 46 | - if ($notification->getApp() !== 'twofactor_backupcodes') { |
|
| 47 | - // Not my app => throw |
|
| 48 | - throw new \InvalidArgumentException(); |
|
| 49 | - } |
|
| 45 | + public function prepare(INotification $notification, $languageCode) { |
|
| 46 | + if ($notification->getApp() !== 'twofactor_backupcodes') { |
|
| 47 | + // Not my app => throw |
|
| 48 | + throw new \InvalidArgumentException(); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - // Read the language from the notification |
|
| 52 | - $l = $this->factory->get('twofactor_backupcodes', $languageCode); |
|
| 51 | + // Read the language from the notification |
|
| 52 | + $l = $this->factory->get('twofactor_backupcodes', $languageCode); |
|
| 53 | 53 | |
| 54 | - switch ($notification->getSubject()) { |
|
| 55 | - case 'create_backupcodes': |
|
| 56 | - $notification->setParsedSubject( |
|
| 57 | - $l->t('Generate backup codes') |
|
| 58 | - )->setParsedMessage( |
|
| 59 | - $l->t('You enabled two-factor authentication but did not generate backup codes yet. They are needed to restore access to your account in case you lose your second factor.') |
|
| 60 | - ); |
|
| 54 | + switch ($notification->getSubject()) { |
|
| 55 | + case 'create_backupcodes': |
|
| 56 | + $notification->setParsedSubject( |
|
| 57 | + $l->t('Generate backup codes') |
|
| 58 | + )->setParsedMessage( |
|
| 59 | + $l->t('You enabled two-factor authentication but did not generate backup codes yet. They are needed to restore access to your account in case you lose your second factor.') |
|
| 60 | + ); |
|
| 61 | 61 | |
| 62 | - $notification->setLink($this->url->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'security'])); |
|
| 62 | + $notification->setLink($this->url->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'security'])); |
|
| 63 | 63 | |
| 64 | - $notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/password.svg'))); |
|
| 64 | + $notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/password.svg'))); |
|
| 65 | 65 | |
| 66 | - return $notification; |
|
| 66 | + return $notification; |
|
| 67 | 67 | |
| 68 | - default: |
|
| 69 | - // Unknown subject => Unknown notification => throw |
|
| 70 | - throw new \InvalidArgumentException(); |
|
| 71 | - } |
|
| 72 | - } |
|
| 68 | + default: |
|
| 69 | + // Unknown subject => Unknown notification => throw |
|
| 70 | + throw new \InvalidArgumentException(); |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | 74 | } |