mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Clean up notifications
This commit is contained in:
parent
8030167ffc
commit
b3560ff525
42
app/Events/Security/UserAttemptedLogin.php
Normal file
42
app/Events/Security/UserAttemptedLogin.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* UserAttemptedLogin.php
|
||||||
|
* Copyright (c) 2024 james@firefly-iii.org.
|
||||||
|
*
|
||||||
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Events\Security;
|
||||||
|
|
||||||
|
use FireflyIII\Events\Event;
|
||||||
|
use Illuminate\Contracts\Auth\Authenticatable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class UserAttemptedLogin extends Event
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
public User $user;
|
||||||
|
|
||||||
|
public function __construct(null | Authenticatable | User $user)
|
||||||
|
{
|
||||||
|
if ($user instanceof User) {
|
||||||
|
$this->user = $user;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -31,6 +31,7 @@ use FireflyIII\Events\Admin\InvitationCreated;
|
|||||||
use FireflyIII\Events\DetectedNewIPAddress;
|
use FireflyIII\Events\DetectedNewIPAddress;
|
||||||
use FireflyIII\Events\RegisteredUser;
|
use FireflyIII\Events\RegisteredUser;
|
||||||
use FireflyIII\Events\RequestedNewPassword;
|
use FireflyIII\Events\RequestedNewPassword;
|
||||||
|
use FireflyIII\Events\Security\UserAttemptedLogin;
|
||||||
use FireflyIII\Events\Test\OwnerTestNotificationChannel;
|
use FireflyIII\Events\Test\OwnerTestNotificationChannel;
|
||||||
use FireflyIII\Events\Test\UserTestNotificationChannel;
|
use FireflyIII\Events\Test\UserTestNotificationChannel;
|
||||||
use FireflyIII\Events\UserChangedEmail;
|
use FireflyIII\Events\UserChangedEmail;
|
||||||
@ -435,6 +436,26 @@ class UserEventHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sendLoginAttemptNotification(UserAttemptedLogin $event): void {
|
||||||
|
try {
|
||||||
|
Notification::send($event->user, new UserFailedLoginAttempt($event->user));
|
||||||
|
} catch (\Exception $e) { // @phpstan-ignore-line
|
||||||
|
$message = $e->getMessage();
|
||||||
|
if (str_contains($message, 'Bcc')) {
|
||||||
|
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (str_contains($message, 'RFC 2822')) {
|
||||||
|
app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
app('log')->error($e->getMessage());
|
||||||
|
app('log')->error($e->getTraceAsString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a test message to an administrator.
|
* Sends a test message to an administrator.
|
||||||
*/
|
*/
|
||||||
|
@ -127,10 +127,14 @@ class LoginController extends Controller
|
|||||||
}
|
}
|
||||||
app('log')->warning('Login attempt failed.');
|
app('log')->warning('Login attempt failed.');
|
||||||
$username = (string) $request->get($this->username());
|
$username = (string) $request->get($this->username());
|
||||||
if (null === $this->repository->findByEmail($username)) {
|
$user = $this->repository->findByEmail($username);
|
||||||
|
if (null === $user) {
|
||||||
// send event to owner.
|
// send event to owner.
|
||||||
event(new UnknownUserAttemptedLogin($username));
|
event(new UnknownUserAttemptedLogin($username));
|
||||||
}
|
}
|
||||||
|
if(null !== $user) {
|
||||||
|
event(new UserAttemptedLogin($user));
|
||||||
|
}
|
||||||
|
|
||||||
// Copied directly from AuthenticatesUsers, but with logging added:
|
// Copied directly from AuthenticatesUsers, but with logging added:
|
||||||
// If the login attempt was unsuccessful we will increment the number of attempts
|
// If the login attempt was unsuccessful we will increment the number of attempts
|
||||||
|
@ -39,21 +39,12 @@ class UnknownUserLoginAttempt extends Notification
|
|||||||
use Queueable;
|
use Queueable;
|
||||||
private string $address;
|
private string $address;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(string $address)
|
public function __construct(string $address)
|
||||||
{
|
{
|
||||||
$this->address = $address;
|
$this->address = $address;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toArray(OwnerNotifiable $notifiable)
|
public function toArray(OwnerNotifiable $notifiable)
|
||||||
@ -63,8 +54,6 @@ class UnknownUserLoginAttempt extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toMail(OwnerNotifiable $notifiable): MailMessage
|
public function toMail(OwnerNotifiable $notifiable): MailMessage
|
||||||
@ -76,8 +65,6 @@ class UnknownUserLoginAttempt extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toSlack(OwnerNotifiable $notifiable): SlackMessage
|
public function toSlack(OwnerNotifiable $notifiable): SlackMessage
|
||||||
@ -87,6 +74,9 @@ class UnknownUserLoginAttempt extends Notification
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*/
|
||||||
public function toPushover(OwnerNotifiable $notifiable): PushoverMessage
|
public function toPushover(OwnerNotifiable $notifiable): PushoverMessage
|
||||||
{
|
{
|
||||||
return PushoverMessage::create((string) trans('email.unknown_user_message', ['address' => $this->address]))
|
return PushoverMessage::create((string) trans('email.unknown_user_message', ['address' => $this->address]))
|
||||||
@ -94,6 +84,9 @@ class UnknownUserLoginAttempt extends Notification
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*/
|
||||||
public function toNtfy(OwnerNotifiable $notifiable): Message
|
public function toNtfy(OwnerNotifiable $notifiable): Message
|
||||||
{
|
{
|
||||||
$settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
|
$settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
|
||||||
@ -106,8 +99,6 @@ class UnknownUserLoginAttempt extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function via(OwnerNotifiable $notifiable)
|
public function via(OwnerNotifiable $notifiable)
|
||||||
|
@ -46,9 +46,7 @@ class UserInvitation extends Notification
|
|||||||
private InvitedUser $invitee;
|
private InvitedUser $invitee;
|
||||||
private OwnerNotifiable $owner;
|
private OwnerNotifiable $owner;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(OwnerNotifiable $owner, InvitedUser $invitee)
|
public function __construct(OwnerNotifiable $owner, InvitedUser $invitee)
|
||||||
{
|
{
|
||||||
$this->invitee = $invitee;
|
$this->invitee = $invitee;
|
||||||
@ -56,12 +54,6 @@ class UserInvitation extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toArray(OwnerNotifiable $notifiable)
|
public function toArray(OwnerNotifiable $notifiable)
|
||||||
@ -71,12 +63,6 @@ class UserInvitation extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toMail(OwnerNotifiable $notifiable)
|
public function toMail(OwnerNotifiable $notifiable)
|
||||||
@ -88,12 +74,6 @@ class UserInvitation extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toSlack(OwnerNotifiable $notifiable)
|
public function toSlack(OwnerNotifiable $notifiable)
|
||||||
@ -102,7 +82,9 @@ class UserInvitation extends Notification
|
|||||||
(string) trans('email.invitation_created_body', ['email' => $this->invitee->user->email, 'invitee' => $this->invitee->email])
|
(string) trans('email.invitation_created_body', ['email' => $this->invitee->user->email, 'invitee' => $this->invitee->email])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*/
|
||||||
public function toPushover(OwnerNotifiable $notifiable): PushoverMessage
|
public function toPushover(OwnerNotifiable $notifiable): PushoverMessage
|
||||||
{
|
{
|
||||||
Log::debug('Now in toPushover() for UserInvitation');
|
Log::debug('Now in toPushover() for UserInvitation');
|
||||||
@ -111,7 +93,9 @@ class UserInvitation extends Notification
|
|||||||
->title((string) trans('email.invitation_created_subject'))
|
->title((string) trans('email.invitation_created_subject'))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*/
|
||||||
public function toNtfy(OwnerNotifiable $notifiable): Message
|
public function toNtfy(OwnerNotifiable $notifiable): Message
|
||||||
{
|
{
|
||||||
Log::debug('Now in toNtfy() for UserInvitation');
|
Log::debug('Now in toNtfy() for UserInvitation');
|
||||||
@ -125,12 +109,6 @@ class UserInvitation extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function via(OwnerNotifiable $notifiable)
|
public function via(OwnerNotifiable $notifiable)
|
||||||
|
@ -46,9 +46,7 @@ class UserRegistration extends Notification
|
|||||||
private OwnerNotifiable $owner;
|
private OwnerNotifiable $owner;
|
||||||
private User $user;
|
private User $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(OwnerNotifiable $owner, User $user)
|
public function __construct(OwnerNotifiable $owner, User $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
@ -56,8 +54,6 @@ class UserRegistration extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toArray(OwnerNotifiable $notifiable)
|
public function toArray(OwnerNotifiable $notifiable)
|
||||||
@ -67,12 +63,6 @@ class UserRegistration extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toMail(OwnerNotifiable $notifiable)
|
public function toMail(OwnerNotifiable $notifiable)
|
||||||
@ -84,19 +74,15 @@ class UserRegistration extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toSlack(OwnerNotifiable $notifiable)
|
public function toSlack(OwnerNotifiable $notifiable)
|
||||||
{
|
{
|
||||||
return (new SlackMessage())->content((string) trans('email.admin_new_user_registered', ['email' => $this->user->email, 'id' => $this->user->id]));
|
return (new SlackMessage())->content((string) trans('email.admin_new_user_registered', ['email' => $this->user->email, 'id' => $this->user->id]));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*/
|
||||||
public function toPushover(OwnerNotifiable $notifiable): PushoverMessage
|
public function toPushover(OwnerNotifiable $notifiable): PushoverMessage
|
||||||
{
|
{
|
||||||
Log::debug('Now in toPushover() for UserRegistration');
|
Log::debug('Now in toPushover() for UserRegistration');
|
||||||
@ -105,7 +91,9 @@ class UserRegistration extends Notification
|
|||||||
->title((string) trans('email.registered_subject_admin'))
|
->title((string) trans('email.registered_subject_admin'))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*/
|
||||||
public function toNtfy(OwnerNotifiable $notifiable): Message
|
public function toNtfy(OwnerNotifiable $notifiable): Message
|
||||||
{
|
{
|
||||||
Log::debug('Now in toNtfy() for (Admin) UserRegistration');
|
Log::debug('Now in toNtfy() for (Admin) UserRegistration');
|
||||||
@ -119,12 +107,6 @@ class UserRegistration extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function via(OwnerNotifiable $notifiable)
|
public function via(OwnerNotifiable $notifiable)
|
||||||
|
@ -44,21 +44,13 @@ class VersionCheckResult extends Notification
|
|||||||
|
|
||||||
private string $message;
|
private string $message;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(string $message)
|
public function __construct(string $message)
|
||||||
{
|
{
|
||||||
$this->message = $message;
|
$this->message = $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toArray(OwnerNotifiable $notifiable)
|
public function toArray(OwnerNotifiable $notifiable)
|
||||||
@ -68,12 +60,6 @@ class VersionCheckResult extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toMail(OwnerNotifiable $notifiable)
|
public function toMail(OwnerNotifiable $notifiable)
|
||||||
@ -85,12 +71,6 @@ class VersionCheckResult extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toSlack(OwnerNotifiable $notifiable)
|
public function toSlack(OwnerNotifiable $notifiable)
|
||||||
@ -101,7 +81,9 @@ class VersionCheckResult extends Notification
|
|||||||
})
|
})
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*/
|
||||||
public function toPushover(OwnerNotifiable $notifiable): PushoverMessage
|
public function toPushover(OwnerNotifiable $notifiable): PushoverMessage
|
||||||
{
|
{
|
||||||
Log::debug('Now in toPushover() for VersionCheckResult');
|
Log::debug('Now in toPushover() for VersionCheckResult');
|
||||||
@ -110,7 +92,9 @@ class VersionCheckResult extends Notification
|
|||||||
->title((string) trans('email.new_version_email_subject'))
|
->title((string) trans('email.new_version_email_subject'))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*/
|
||||||
public function toNtfy(OwnerNotifiable $notifiable): Message
|
public function toNtfy(OwnerNotifiable $notifiable): Message
|
||||||
{
|
{
|
||||||
Log::debug('Now in toNtfy() for VersionCheckResult');
|
Log::debug('Now in toNtfy() for VersionCheckResult');
|
||||||
@ -124,12 +108,6 @@ class VersionCheckResult extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function via(OwnerNotifiable $notifiable)
|
public function via(OwnerNotifiable $notifiable)
|
||||||
|
@ -42,21 +42,11 @@ class DisabledMFANotification extends Notification
|
|||||||
|
|
||||||
private User $user;
|
private User $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(User $user)
|
public function __construct(User $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param User $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toArray(User $notifiable)
|
public function toArray(User $notifiable)
|
||||||
@ -66,12 +56,6 @@ class DisabledMFANotification extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param User $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toMail(User $notifiable)
|
public function toMail(User $notifiable)
|
||||||
@ -80,14 +64,7 @@ class DisabledMFANotification extends Notification
|
|||||||
|
|
||||||
return (new MailMessage())->markdown('emails.security.disabled-mfa', ['user' => $this->user])->subject($subject);
|
return (new MailMessage())->markdown('emails.security.disabled-mfa', ['user' => $this->user])->subject($subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param User $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function toSlack(User $notifiable)
|
public function toSlack(User $notifiable)
|
||||||
@ -96,7 +73,9 @@ class DisabledMFANotification extends Notification
|
|||||||
|
|
||||||
return (new SlackMessage())->content($message);
|
return (new SlackMessage())->content($message);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*/
|
||||||
public function toPushover(User $notifiable): PushoverMessage
|
public function toPushover(User $notifiable): PushoverMessage
|
||||||
{
|
{
|
||||||
Log::debug('Now in (user) toPushover()');
|
Log::debug('Now in (user) toPushover()');
|
||||||
@ -104,6 +83,9 @@ class DisabledMFANotification extends Notification
|
|||||||
return PushoverMessage::create((string) trans('email.disabled_mfa_slack', ['email' => $this->user->email]))
|
return PushoverMessage::create((string) trans('email.disabled_mfa_slack', ['email' => $this->user->email]))
|
||||||
->title((string)trans('email.disabled_mfa_subject'));
|
->title((string)trans('email.disabled_mfa_subject'));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*/
|
||||||
public function toNtfy(User $user): Message
|
public function toNtfy(User $user): Message
|
||||||
{
|
{
|
||||||
$settings = ReturnsSettings::getSettings('ntfy', 'user', $user);
|
$settings = ReturnsSettings::getSettings('ntfy', 'user', $user);
|
||||||
@ -116,12 +98,6 @@ class DisabledMFANotification extends Notification
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param User $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
*/
|
*/
|
||||||
public function via(User $notifiable)
|
public function via(User $notifiable)
|
||||||
|
@ -37,38 +37,20 @@ class EnabledMFANotification extends Notification
|
|||||||
|
|
||||||
private User $user;
|
private User $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(User $user)
|
public function __construct(User $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
public function toMail($notifiable)
|
||||||
{
|
{
|
||||||
$subject = (string)trans('email.enabled_mfa_subject');
|
$subject = (string)trans('email.enabled_mfa_subject');
|
||||||
@ -76,15 +58,7 @@ class EnabledMFANotification extends Notification
|
|||||||
return (new MailMessage())->markdown('emails.security.enabled-mfa', ['user' => $this->user])->subject($subject);
|
return (new MailMessage())->markdown('emails.security.enabled-mfa', ['user' => $this->user])->subject($subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toSlack($notifiable)
|
public function toSlack($notifiable)
|
||||||
{
|
{
|
||||||
$message = (string)trans('email.enabled_mfa_slack', ['email' => $this->user->email]);
|
$message = (string)trans('email.enabled_mfa_slack', ['email' => $this->user->email]);
|
||||||
@ -92,15 +66,7 @@ class EnabledMFANotification extends Notification
|
|||||||
return (new SlackMessage())->content($message);
|
return (new SlackMessage())->content($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
|
@ -38,39 +38,21 @@ class MFABackupFewLeftNotification extends Notification
|
|||||||
private User $user;
|
private User $user;
|
||||||
private int $count;
|
private int $count;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(User $user, int $count)
|
public function __construct(User $user, int $count)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->count = $count;
|
$this->count = $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
public function toMail($notifiable)
|
||||||
{
|
{
|
||||||
$subject = (string)trans('email.mfa_few_backups_left_subject', ['count' => $this->count]);
|
$subject = (string)trans('email.mfa_few_backups_left_subject', ['count' => $this->count]);
|
||||||
@ -78,15 +60,7 @@ class MFABackupFewLeftNotification extends Notification
|
|||||||
return (new MailMessage())->markdown('emails.security.few-backup-codes', ['user' => $this->user, 'count' => $this->count])->subject($subject);
|
return (new MailMessage())->markdown('emails.security.few-backup-codes', ['user' => $this->user, 'count' => $this->count])->subject($subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toSlack($notifiable)
|
public function toSlack($notifiable)
|
||||||
{
|
{
|
||||||
$message = (string)trans('email.mfa_few_backups_left_slack', ['email' => $this->user->email, 'count' => $this->count]);
|
$message = (string)trans('email.mfa_few_backups_left_slack', ['email' => $this->user->email, 'count' => $this->count]);
|
||||||
@ -94,15 +68,7 @@ class MFABackupFewLeftNotification extends Notification
|
|||||||
return (new SlackMessage())->content($message);
|
return (new SlackMessage())->content($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
|
@ -37,38 +37,20 @@ class MFABackupNoLeftNotification extends Notification
|
|||||||
|
|
||||||
private User $user;
|
private User $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(User $user)
|
public function __construct(User $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
public function toMail($notifiable)
|
||||||
{
|
{
|
||||||
$subject = (string)trans('email.mfa_no_backups_left_subject');
|
$subject = (string)trans('email.mfa_no_backups_left_subject');
|
||||||
@ -76,15 +58,7 @@ class MFABackupNoLeftNotification extends Notification
|
|||||||
return (new MailMessage())->markdown('emails.security.no-backup-codes', ['user' => $this->user])->subject($subject);
|
return (new MailMessage())->markdown('emails.security.no-backup-codes', ['user' => $this->user])->subject($subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toSlack($notifiable)
|
public function toSlack($notifiable)
|
||||||
{
|
{
|
||||||
$message = (string)trans('email.mfa_no_backups_left_slack', ['email' => $this->user->email]);
|
$message = (string)trans('email.mfa_no_backups_left_slack', ['email' => $this->user->email]);
|
||||||
@ -92,15 +66,7 @@ class MFABackupNoLeftNotification extends Notification
|
|||||||
return (new SlackMessage())->content($message);
|
return (new SlackMessage())->content($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
|
@ -38,39 +38,21 @@ class MFAManyFailedAttemptsNotification extends Notification
|
|||||||
private User $user;
|
private User $user;
|
||||||
private int $count;
|
private int $count;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(User $user, int $count)
|
public function __construct(User $user, int $count)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->count = $count;
|
$this->count = $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
public function toMail($notifiable)
|
||||||
{
|
{
|
||||||
$subject = (string)trans('email.mfa_many_failed_subject', ['count' => $this->count]);
|
$subject = (string)trans('email.mfa_many_failed_subject', ['count' => $this->count]);
|
||||||
@ -78,15 +60,7 @@ class MFAManyFailedAttemptsNotification extends Notification
|
|||||||
return (new MailMessage())->markdown('emails.security.many-failed-attempts', ['user' => $this->user, 'count' => $this->count])->subject($subject);
|
return (new MailMessage())->markdown('emails.security.many-failed-attempts', ['user' => $this->user, 'count' => $this->count])->subject($subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toSlack($notifiable)
|
public function toSlack($notifiable)
|
||||||
{
|
{
|
||||||
$message = (string)trans('email.mfa_many_failed_slack', ['email' => $this->user->email, 'count' => $this->count]);
|
$message = (string)trans('email.mfa_many_failed_slack', ['email' => $this->user->email, 'count' => $this->count]);
|
||||||
@ -94,15 +68,7 @@ class MFAManyFailedAttemptsNotification extends Notification
|
|||||||
return (new SlackMessage())->content($message);
|
return (new SlackMessage())->content($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
|
@ -37,38 +37,20 @@ class MFAUsedBackupCodeNotification extends Notification
|
|||||||
|
|
||||||
private User $user;
|
private User $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(User $user)
|
public function __construct(User $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
public function toMail($notifiable)
|
||||||
{
|
{
|
||||||
$subject = (string)trans('email.used_backup_code_subject');
|
$subject = (string)trans('email.used_backup_code_subject');
|
||||||
@ -76,15 +58,7 @@ class MFAUsedBackupCodeNotification extends Notification
|
|||||||
return (new MailMessage())->markdown('emails.security.used-backup-code', ['user' => $this->user])->subject($subject);
|
return (new MailMessage())->markdown('emails.security.used-backup-code', ['user' => $this->user])->subject($subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toSlack($notifiable)
|
public function toSlack($notifiable)
|
||||||
{
|
{
|
||||||
$message = (string)trans('email.used_backup_code_slack', ['email' => $this->user->email]);
|
$message = (string)trans('email.used_backup_code_slack', ['email' => $this->user->email]);
|
||||||
@ -92,15 +66,7 @@ class MFAUsedBackupCodeNotification extends Notification
|
|||||||
return (new SlackMessage())->content($message);
|
return (new SlackMessage())->content($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
|
@ -37,38 +37,20 @@ class NewBackupCodesNotification extends Notification
|
|||||||
|
|
||||||
private User $user;
|
private User $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(User $user)
|
public function __construct(User $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
public function toMail($notifiable)
|
||||||
{
|
{
|
||||||
$subject = (string)trans('email.new_backup_codes_subject');
|
$subject = (string)trans('email.new_backup_codes_subject');
|
||||||
@ -76,15 +58,7 @@ class NewBackupCodesNotification extends Notification
|
|||||||
return (new MailMessage())->markdown('emails.security.new-backup-codes', ['user' => $this->user])->subject($subject);
|
return (new MailMessage())->markdown('emails.security.new-backup-codes', ['user' => $this->user])->subject($subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toSlack($notifiable)
|
public function toSlack($notifiable)
|
||||||
{
|
{
|
||||||
$message = (string)trans('email.new_backup_codes_slack', ['email' => $this->user->email]);
|
$message = (string)trans('email.new_backup_codes_slack', ['email' => $this->user->email]);
|
||||||
@ -92,15 +66,7 @@ class NewBackupCodesNotification extends Notification
|
|||||||
return (new SlackMessage())->content($message);
|
return (new SlackMessage())->content($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
|
82
app/Notifications/Security/UserFailedLoginAttempt.php
Normal file
82
app/Notifications/Security/UserFailedLoginAttempt.php
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* UserFailedLoginAttempt.php
|
||||||
|
* Copyright (c) 2024 james@firefly-iii.org.
|
||||||
|
*
|
||||||
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Notifications\Security;
|
||||||
|
|
||||||
|
use FireflyIII\Support\Notifications\UrlValidator;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
use Illuminate\Notifications\Messages\SlackMessage;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
class UserFailedLoginAttempt extends Notification
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
private User $user;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct(User $user)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function toArray($notifiable)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function toMail($notifiable)
|
||||||
|
{
|
||||||
|
$subject = (string)trans('email.new_backup_codes_subject');
|
||||||
|
|
||||||
|
return (new MailMessage())->markdown('emails.security.new-backup-codes', ['user' => $this->user])->subject($subject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function toSlack($notifiable)
|
||||||
|
{
|
||||||
|
$message = (string)trans('email.new_backup_codes_slack', ['email' => $this->user->email]);
|
||||||
|
|
||||||
|
return (new SlackMessage())->content($message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function via($notifiable)
|
||||||
|
{
|
||||||
|
/** @var null|User $user */
|
||||||
|
$user = auth()->user();
|
||||||
|
$slackUrl = null === $user ? '' : app('preferences')->getForUser(auth()->user(), 'slack_webhook_url', '')->data;
|
||||||
|
if (is_array($slackUrl)) {
|
||||||
|
$slackUrl = '';
|
||||||
|
}
|
||||||
|
if (UrlValidator::isValidWebhookURL((string)$slackUrl)) {
|
||||||
|
return ['mail', 'slack'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['mail'];
|
||||||
|
}
|
||||||
|
}
|
@ -38,9 +38,7 @@ class OwnerTestNotificationEmail extends Notification
|
|||||||
|
|
||||||
private OwnerNotifiable $owner;
|
private OwnerNotifiable $owner;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(OwnerNotifiable $owner)
|
public function __construct(OwnerNotifiable $owner)
|
||||||
{
|
{
|
||||||
$this->owner = $owner;
|
$this->owner = $owner;
|
||||||
|
@ -42,9 +42,7 @@ class OwnerTestNotificationNtfy extends Notification
|
|||||||
|
|
||||||
public OwnerNotifiable $owner;
|
public OwnerNotifiable $owner;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(OwnerNotifiable $owner)
|
public function __construct(OwnerNotifiable $owner)
|
||||||
{
|
{
|
||||||
$this->owner = $owner;
|
$this->owner = $owner;
|
||||||
|
@ -42,9 +42,7 @@ class OwnerTestNotificationPushover extends Notification
|
|||||||
|
|
||||||
private OwnerNotifiable $owner;
|
private OwnerNotifiable $owner;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(OwnerNotifiable $owner)
|
public function __construct(OwnerNotifiable $owner)
|
||||||
{
|
{
|
||||||
$this->owner = $owner;
|
$this->owner = $owner;
|
||||||
|
@ -40,9 +40,7 @@ class OwnerTestNotificationSlack extends Notification
|
|||||||
|
|
||||||
private OwnerNotifiable $owner;
|
private OwnerNotifiable $owner;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(OwnerNotifiable $owner)
|
public function __construct(OwnerNotifiable $owner)
|
||||||
{
|
{
|
||||||
$this->owner = $owner;
|
$this->owner = $owner;
|
||||||
|
@ -39,9 +39,7 @@ class UserTestNotificationEmail extends Notification
|
|||||||
|
|
||||||
private User $user;
|
private User $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(User $user)
|
public function __construct(User $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
@ -42,9 +42,7 @@ class UserTestNotificationNtfy extends Notification
|
|||||||
|
|
||||||
public User $user;
|
public User $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(User $user)
|
public function __construct(User $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
@ -43,9 +43,7 @@ class UserTestNotificationPushover extends Notification
|
|||||||
|
|
||||||
private User $user;
|
private User $user;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(User $user)
|
public function __construct(User $user)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
@ -40,9 +40,7 @@ class UserTestNotificationSlack extends Notification
|
|||||||
|
|
||||||
private OwnerNotifiable $owner;
|
private OwnerNotifiable $owner;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(OwnerNotifiable $owner)
|
public function __construct(OwnerNotifiable $owner)
|
||||||
{
|
{
|
||||||
$this->owner = $owner;
|
$this->owner = $owner;
|
||||||
|
@ -43,9 +43,7 @@ class BillReminder extends Notification
|
|||||||
private int $diff;
|
private int $diff;
|
||||||
private string $field;
|
private string $field;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(Bill $bill, string $field, int $diff)
|
public function __construct(Bill $bill, string $field, int $diff)
|
||||||
{
|
{
|
||||||
$this->bill = $bill;
|
$this->bill = $bill;
|
||||||
@ -53,30 +51,14 @@ class BillReminder extends Notification
|
|||||||
$this->diff = $diff;
|
$this->diff = $diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
public function toMail($notifiable)
|
||||||
{
|
{
|
||||||
$subject = (string)trans(sprintf('email.bill_warning_subject_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
|
$subject = (string)trans(sprintf('email.bill_warning_subject_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
|
||||||
@ -90,15 +72,7 @@ class BillReminder extends Notification
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toSlack($notifiable)
|
public function toSlack($notifiable)
|
||||||
{
|
{
|
||||||
$message = (string)trans(sprintf('email.bill_warning_subject_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
|
$message = (string)trans(sprintf('email.bill_warning_subject_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
|
||||||
@ -117,15 +91,7 @@ class BillReminder extends Notification
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
|
@ -38,35 +38,17 @@ class NewAccessToken extends Notification
|
|||||||
{
|
{
|
||||||
use Queueable;
|
use Queueable;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct() {}
|
public function __construct() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
public function toMail($notifiable)
|
||||||
{
|
{
|
||||||
return (new MailMessage())
|
return (new MailMessage())
|
||||||
@ -75,29 +57,13 @@ class NewAccessToken extends Notification
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toSlack($notifiable)
|
public function toSlack($notifiable)
|
||||||
{
|
{
|
||||||
return (new SlackMessage())->content((string)trans('email.access_token_created_body'));
|
return (new SlackMessage())->content((string)trans('email.access_token_created_body'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
|
@ -43,9 +43,7 @@ class RuleActionFailed extends Notification
|
|||||||
private string $ruleLink;
|
private string $ruleLink;
|
||||||
private string $ruleTitle;
|
private string $ruleTitle;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(array $params)
|
public function __construct(array $params)
|
||||||
{
|
{
|
||||||
[$mainMessage, $groupTitle, $groupLink, $ruleTitle, $ruleLink] = $params;
|
[$mainMessage, $groupTitle, $groupLink, $ruleTitle, $ruleLink] = $params;
|
||||||
@ -56,30 +54,14 @@ class RuleActionFailed extends Notification
|
|||||||
$this->ruleLink = $ruleLink;
|
$this->ruleLink = $ruleLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toSlack($notifiable)
|
public function toSlack($notifiable)
|
||||||
{
|
{
|
||||||
$groupTitle = $this->groupTitle;
|
$groupTitle = $this->groupTitle;
|
||||||
@ -94,15 +76,7 @@ class RuleActionFailed extends Notification
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
|
@ -37,38 +37,20 @@ class TransactionCreation extends Notification
|
|||||||
|
|
||||||
private array $collection;
|
private array $collection;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(array $collection)
|
public function __construct(array $collection)
|
||||||
{
|
{
|
||||||
$this->collection = $collection;
|
$this->collection = $collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
public function toMail($notifiable)
|
||||||
{
|
{
|
||||||
return (new MailMessage())
|
return (new MailMessage())
|
||||||
@ -77,15 +59,7 @@ class TransactionCreation extends Notification
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
return ['mail'];
|
return ['mail'];
|
||||||
|
@ -41,38 +41,20 @@ class UserLogin extends Notification
|
|||||||
|
|
||||||
private string $ip;
|
private string $ip;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(string $ip)
|
public function __construct(string $ip)
|
||||||
{
|
{
|
||||||
$this->ip = $ip;
|
$this->ip = $ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
public function toMail($notifiable)
|
||||||
{
|
{
|
||||||
$time = now(config('app.timezone'))->isoFormat((string)trans('config.date_time_js'));
|
$time = now(config('app.timezone'))->isoFormat((string)trans('config.date_time_js'));
|
||||||
@ -94,15 +76,7 @@ class UserLogin extends Notification
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Slack representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return SlackMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toSlack($notifiable)
|
public function toSlack($notifiable)
|
||||||
{
|
{
|
||||||
$host = '';
|
$host = '';
|
||||||
@ -120,15 +94,7 @@ class UserLogin extends Notification
|
|||||||
return (new SlackMessage())->content((string)trans('email.slack_login_from_new_ip', ['host' => $host, 'ip' => $this->ip]));
|
return (new SlackMessage())->content((string)trans('email.slack_login_from_new_ip', ['host' => $host, 'ip' => $this->ip]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
|
@ -37,38 +37,20 @@ class UserNewPassword extends Notification
|
|||||||
|
|
||||||
private string $url;
|
private string $url;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct(string $url)
|
public function __construct(string $url)
|
||||||
{
|
{
|
||||||
$this->url = $url;
|
$this->url = $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
public function toMail($notifiable)
|
||||||
{
|
{
|
||||||
return (new MailMessage())
|
return (new MailMessage())
|
||||||
@ -77,15 +59,7 @@ class UserNewPassword extends Notification
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
return ['mail'];
|
return ['mail'];
|
||||||
|
@ -35,35 +35,17 @@ class UserRegistration extends Notification
|
|||||||
{
|
{
|
||||||
use Queueable;
|
use Queueable;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new notification instance.
|
|
||||||
*/
|
|
||||||
public function __construct() {}
|
public function __construct() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the array representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the mail representation of the notification.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return MailMessage
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function toMail($notifiable)
|
public function toMail($notifiable)
|
||||||
{
|
{
|
||||||
return (new MailMessage())
|
return (new MailMessage())
|
||||||
@ -72,15 +54,7 @@ class UserRegistration extends Notification
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the notification's delivery channels.
|
|
||||||
*
|
|
||||||
* @param mixed $notifiable
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*
|
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
|
||||||
*/
|
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
return ['mail'];
|
return ['mail'];
|
||||||
|
@ -47,6 +47,7 @@ use FireflyIII\Events\Security\MFAManyFailedAttempts;
|
|||||||
use FireflyIII\Events\Security\MFANewBackupCodes;
|
use FireflyIII\Events\Security\MFANewBackupCodes;
|
||||||
use FireflyIII\Events\Security\MFAUsedBackupCode;
|
use FireflyIII\Events\Security\MFAUsedBackupCode;
|
||||||
use FireflyIII\Events\Security\UnknownUserAttemptedLogin;
|
use FireflyIII\Events\Security\UnknownUserAttemptedLogin;
|
||||||
|
use FireflyIII\Events\Security\UserAttemptedLogin;
|
||||||
use FireflyIII\Events\StoredAccount;
|
use FireflyIII\Events\StoredAccount;
|
||||||
use FireflyIII\Events\StoredTransactionGroup;
|
use FireflyIII\Events\StoredTransactionGroup;
|
||||||
use FireflyIII\Events\Test\OwnerTestNotificationChannel;
|
use FireflyIII\Events\Test\OwnerTestNotificationChannel;
|
||||||
@ -109,6 +110,9 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Handlers\Events\UserEventHandler@createGroupMembership',
|
'FireflyIII\Handlers\Events\UserEventHandler@createGroupMembership',
|
||||||
'FireflyIII\Handlers\Events\UserEventHandler@createExchangeRates',
|
'FireflyIII\Handlers\Events\UserEventHandler@createExchangeRates',
|
||||||
],
|
],
|
||||||
|
UserAttemptedLogin::class => [
|
||||||
|
'FireflyIII\Handlers\Events\UserEventHandler@sendLoginAttemptNotification',
|
||||||
|
],
|
||||||
// is a User related event.
|
// is a User related event.
|
||||||
Login::class => [
|
Login::class => [
|
||||||
'FireflyIII\Handlers\Events\UserEventHandler@checkSingleUserIsAdmin',
|
'FireflyIII\Handlers\Events\UserEventHandler@checkSingleUserIsAdmin',
|
||||||
|
Loading…
Reference in New Issue
Block a user