mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-26 02:40:43 -06:00
Fix extra notification
This commit is contained in:
parent
45d7042405
commit
600fa388c1
@ -22,7 +22,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Notifications\Admin;
|
||||
|
||||
use FireflyIII\Mail\AdminTestMail;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
@ -50,7 +49,7 @@ class TestNotification extends Notification
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
@ -61,7 +60,7 @@ class TestNotification extends Notification
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
@ -70,6 +69,7 @@ class TestNotification extends Notification
|
||||
->markdown('emails.admin-test', ['email' => $this->address])
|
||||
->subject((string) trans('email.admin_test_subject'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Slack representation of the notification.
|
||||
*
|
||||
@ -78,13 +78,13 @@ class TestNotification extends Notification
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
return (new SlackMessage)->content((string)trans('email.admin_test_subject'));
|
||||
return (new SlackMessage)->content((string) trans('email.admin_test_subject'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Notifications\User;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class NewAccessToken extends Notification
|
||||
@ -47,7 +48,7 @@ class NewAccessToken extends Notification
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail'];
|
||||
return ['mail', 'slack'];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,6 +63,16 @@ class NewAccessToken extends Notification
|
||||
->markdown('emails.token-created')
|
||||
->subject((string) trans('email.access_token_created_subject'));
|
||||
}
|
||||
/**
|
||||
* Get the Slack representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return SlackMessage
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
return (new SlackMessage)->content((string) trans('email.access_token_created_body'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
|
@ -25,6 +25,7 @@ namespace FireflyIII\Notifications\User;
|
||||
use Exception;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class UserLogin extends Notification
|
||||
@ -51,7 +52,7 @@ class UserLogin extends Notification
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail'];
|
||||
return ['mail', 'slack'];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,6 +79,27 @@ class UserLogin extends Notification
|
||||
->subject((string) trans('email.login_from_new_ip'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Slack representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return SlackMessage
|
||||
*/
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
$host = '';
|
||||
try {
|
||||
$hostName = gethostbyaddr($this->ip);
|
||||
} catch (Exception $e) {
|
||||
$hostName = $this->ip;
|
||||
}
|
||||
if ($hostName !== $this->ip) {
|
||||
$host = $hostName;
|
||||
}
|
||||
|
||||
return (new SlackMessage)->content((string) trans('email.slack_login_from_new_ip', ['host' => $host, 'ip' => $this->ip]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
|
@ -35,6 +35,7 @@ return [
|
||||
|
||||
// new IP
|
||||
'login_from_new_ip' => 'New login on Firefly III',
|
||||
'slack_login_from_new_ip' => 'New Firefly III login from IP :ip (:host)',
|
||||
'new_ip_body' => 'Firefly III detected a new login on your account from an unknown IP address. If you never logged in from the IP address below, or it has been more than six months ago, Firefly III will warn you.',
|
||||
'new_ip_warning' => 'If you recognize this IP address or the login, you can ignore this message. If you didn\'t login, of if you have no idea what this is about, verify your password security, change it, and log out all other sessions. To do this, go to your profile page. Of course you have 2FA enabled already, right? Stay safe!',
|
||||
'ip_address' => 'IP address',
|
||||
|
Loading…
Reference in New Issue
Block a user