mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
Clean up and fix notifications.
This commit is contained in:
@@ -65,12 +65,9 @@ class DisabledMFANotification extends Notification
|
||||
return (new MailMessage())->markdown('emails.security.disabled-mfa', ['user' => $this->user])->subject($subject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toNtfy(User $user): Message
|
||||
public function toNtfy(User $notifiable): Message
|
||||
{
|
||||
$settings = ReturnsSettings::getSettings('ntfy', 'user', $user);
|
||||
$settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
|
||||
$message = new Message();
|
||||
$message->topic($settings['ntfy_topic']);
|
||||
$message->title((string) trans('email.disabled_mfa_subject'));
|
||||
@@ -84,8 +81,6 @@ class DisabledMFANotification extends Notification
|
||||
*/
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
Log::debug('Now in (user) toPushover()');
|
||||
|
||||
return PushoverMessage::create((string) trans('email.disabled_mfa_slack', ['email' => $this->user->email]))
|
||||
->title((string) trans('email.disabled_mfa_subject'));
|
||||
}
|
||||
@@ -97,7 +92,7 @@ class DisabledMFANotification extends Notification
|
||||
{
|
||||
$message = (string) trans('email.disabled_mfa_slack', ['email' => $this->user->email]);
|
||||
|
||||
return (new SlackMessage())->content($message);
|
||||
return new SlackMessage()->content($message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -25,11 +25,14 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Notifications\Security;
|
||||
|
||||
use FireflyIII\Notifications\ReturnsAvailableChannels;
|
||||
use FireflyIII\Notifications\ReturnsSettings;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use NotificationChannels\Pushover\PushoverMessage;
|
||||
use Ntfy\Message;
|
||||
|
||||
class EnabledMFANotification extends Notification
|
||||
{
|
||||
@@ -62,6 +65,26 @@ class EnabledMFANotification extends Notification
|
||||
return (new MailMessage())->markdown('emails.security.enabled-mfa', ['user' => $this->user])->subject($subject);
|
||||
}
|
||||
|
||||
public function toNtfy(User $notifiable): Message
|
||||
{
|
||||
$settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
|
||||
$message = new Message();
|
||||
$message->topic($settings['ntfy_topic']);
|
||||
$message->title((string) trans('email.enabled_mfa_subject'));
|
||||
$message->body((string) trans('email.enabled_mfa_slack', ['email' => $this->user->email]));
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.enabled_mfa_slack', ['email' => $this->user->email]))
|
||||
->title((string) trans('email.enabled_mfa_subject'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
@@ -69,7 +92,7 @@ class EnabledMFANotification extends Notification
|
||||
{
|
||||
$message = (string) trans('email.enabled_mfa_slack', ['email' => $this->user->email]);
|
||||
|
||||
return (new SlackMessage())->content($message);
|
||||
return new SlackMessage()->content($message);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -25,11 +25,14 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Notifications\Security;
|
||||
|
||||
use FireflyIII\Notifications\ReturnsAvailableChannels;
|
||||
use FireflyIII\Notifications\ReturnsSettings;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use NotificationChannels\Pushover\PushoverMessage;
|
||||
use Ntfy\Message;
|
||||
|
||||
class MFABackupFewLeftNotification extends Notification
|
||||
{
|
||||
@@ -70,7 +73,27 @@ class MFABackupFewLeftNotification extends Notification
|
||||
{
|
||||
$message = (string) trans('email.mfa_few_backups_left_slack', ['email' => $this->user->email, 'count' => $this->count]);
|
||||
|
||||
return (new SlackMessage())->content($message);
|
||||
return new SlackMessage()->content($message);
|
||||
}
|
||||
|
||||
public function toNtfy(User $notifiable): Message
|
||||
{
|
||||
$settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
|
||||
$message = new Message();
|
||||
$message->topic($settings['ntfy_topic']);
|
||||
$message->title((string) trans('email.mfa_few_backups_left_subject'));
|
||||
$message->body((string) trans('email.mfa_few_backups_left_slack', ['email' => $this->user->email, 'count' => $this->count]));
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.mfa_few_backups_left_slack', ['email' => $this->user->email, 'count' => $this->count]))
|
||||
->title((string) trans('email.mfa_few_backups_left_subject'));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -25,11 +25,14 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Notifications\Security;
|
||||
|
||||
use FireflyIII\Notifications\ReturnsAvailableChannels;
|
||||
use FireflyIII\Notifications\ReturnsSettings;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use NotificationChannels\Pushover\PushoverMessage;
|
||||
use Ntfy\Message;
|
||||
|
||||
class MFABackupNoLeftNotification extends Notification
|
||||
{
|
||||
@@ -69,7 +72,27 @@ class MFABackupNoLeftNotification extends Notification
|
||||
{
|
||||
$message = (string) trans('email.mfa_no_backups_left_slack', ['email' => $this->user->email]);
|
||||
|
||||
return (new SlackMessage())->content($message);
|
||||
return new SlackMessage()->content($message);
|
||||
}
|
||||
|
||||
public function toNtfy(User $notifiable): Message
|
||||
{
|
||||
$settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
|
||||
$message = new Message();
|
||||
$message->topic($settings['ntfy_topic']);
|
||||
$message->title((string) trans('email.mfa_no_backups_left_subject'));
|
||||
$message->body((string) trans('email.mfa_no_backups_left_slack', ['email' => $this->user->email]));
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.mfa_few_backups_left_slack', ['email' => $this->user->email]))
|
||||
->title((string) trans('email.mfa_no_backups_left_slack'));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -25,11 +25,14 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Notifications\Security;
|
||||
|
||||
use FireflyIII\Notifications\ReturnsAvailableChannels;
|
||||
use FireflyIII\Notifications\ReturnsSettings;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use NotificationChannels\Pushover\PushoverMessage;
|
||||
use Ntfy\Message;
|
||||
|
||||
class MFAManyFailedAttemptsNotification extends Notification
|
||||
{
|
||||
@@ -68,7 +71,27 @@ class MFAManyFailedAttemptsNotification extends Notification
|
||||
{
|
||||
$message = (string) trans('email.mfa_many_failed_slack', ['email' => $this->user->email, 'count' => $this->count]);
|
||||
|
||||
return (new SlackMessage())->content($message);
|
||||
return new SlackMessage()->content($message);
|
||||
}
|
||||
|
||||
public function toNtfy(User $notifiable): Message
|
||||
{
|
||||
$settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
|
||||
$message = new Message();
|
||||
$message->topic($settings['ntfy_topic']);
|
||||
$message->title((string) trans('email.mfa_many_failed_subject'));
|
||||
$message->body((string) trans('email.mfa_many_failed_slack', ['email' => $this->user->email, 'count' => $this->count]));
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.mfa_many_failed_slack', ['email' => $this->user->email, 'count' => $this->count]))
|
||||
->title((string) trans('email.mfa_many_failed_subject'));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -25,11 +25,14 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Notifications\Security;
|
||||
|
||||
use FireflyIII\Notifications\ReturnsAvailableChannels;
|
||||
use FireflyIII\Notifications\ReturnsSettings;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use NotificationChannels\Pushover\PushoverMessage;
|
||||
use Ntfy\Message;
|
||||
|
||||
class MFAUsedBackupCodeNotification extends Notification
|
||||
{
|
||||
@@ -69,9 +72,28 @@ class MFAUsedBackupCodeNotification extends Notification
|
||||
{
|
||||
$message = (string) trans('email.used_backup_code_slack', ['email' => $this->user->email]);
|
||||
|
||||
return (new SlackMessage())->content($message);
|
||||
return new SlackMessage()->content($message);
|
||||
}
|
||||
|
||||
public function toNtfy(User $notifiable): Message
|
||||
{
|
||||
$settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
|
||||
$message = new Message();
|
||||
$message->topic($settings['ntfy_topic']);
|
||||
$message->title((string) trans('email.used_backup_code_subject'));
|
||||
$message->body((string) trans('email.used_backup_code_slack', ['email' => $this->user->email]));
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.used_backup_code_slack', ['email' => $this->user->email]))
|
||||
->title((string) trans('email.used_backup_code_subject'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
|
@@ -25,11 +25,14 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Notifications\Security;
|
||||
|
||||
use FireflyIII\Notifications\ReturnsAvailableChannels;
|
||||
use FireflyIII\Notifications\ReturnsSettings;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use NotificationChannels\Pushover\PushoverMessage;
|
||||
use Ntfy\Message;
|
||||
|
||||
class NewBackupCodesNotification extends Notification
|
||||
{
|
||||
@@ -69,7 +72,27 @@ class NewBackupCodesNotification extends Notification
|
||||
{
|
||||
$message = (string) trans('email.new_backup_codes_slack', ['email' => $this->user->email]);
|
||||
|
||||
return (new SlackMessage())->content($message);
|
||||
return new SlackMessage()->content($message);
|
||||
}
|
||||
|
||||
public function toNtfy(User $notifiable): Message
|
||||
{
|
||||
$settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
|
||||
$message = new Message();
|
||||
$message->topic($settings['ntfy_topic']);
|
||||
$message->title((string) trans('email.new_backup_codes_subject'));
|
||||
$message->body((string) trans('email.new_backup_codes_slack', ['email' => $this->user->email]));
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.new_backup_codes_slack', ['email' => $this->user->email]))
|
||||
->title((string) trans('email.new_backup_codes_subject'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -24,11 +24,14 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Notifications\Security;
|
||||
|
||||
use FireflyIII\Notifications\ReturnsAvailableChannels;
|
||||
use FireflyIII\Notifications\ReturnsSettings;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use NotificationChannels\Pushover\PushoverMessage;
|
||||
use Ntfy\Message;
|
||||
|
||||
class UserFailedLoginAttempt extends Notification
|
||||
{
|
||||
@@ -54,9 +57,9 @@ class UserFailedLoginAttempt extends Notification
|
||||
*/
|
||||
public function toMail(User $notifiable)
|
||||
{
|
||||
$subject = (string) trans('email.new_backup_codes_subject');
|
||||
$subject = (string) trans('email.failed_login_subject');
|
||||
|
||||
return (new MailMessage())->markdown('emails.security.new-backup-codes', ['user' => $this->user])->subject($subject);
|
||||
return (new MailMessage())->markdown('emails.security.failed-login', ['user' => $this->user])->subject($subject);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,9 +67,29 @@ class UserFailedLoginAttempt extends Notification
|
||||
*/
|
||||
public function toSlack(User $notifiable)
|
||||
{
|
||||
$message = (string) trans('email.new_backup_codes_slack', ['email' => $this->user->email]);
|
||||
$message = (string) trans('email.failed_login_message', ['email' => $this->user->email]);
|
||||
|
||||
return (new SlackMessage())->content($message);
|
||||
return new SlackMessage()->content($message);
|
||||
}
|
||||
|
||||
public function toNtfy(User $notifiable): Message
|
||||
{
|
||||
$settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
|
||||
$message = new Message();
|
||||
$message->topic($settings['ntfy_topic']);
|
||||
$message->title((string) trans('email.failed_login_subject'));
|
||||
$message->body((string) trans('email.failed_login_message', ['email' => $this->user->email]));
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function toPushover(User $notifiable): PushoverMessage
|
||||
{
|
||||
return PushoverMessage::create((string) trans('email.failed_login_message', ['email' => $this->user->email]))
|
||||
->title((string) trans('email.failed_login_subject'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user