2023-07-23 07:27:52 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications\Netmails;
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
|
|
use App\Notifications\Netmails;
|
|
|
|
use App\Classes\FTN\Message;
|
|
|
|
use App\Models\{Netmail,System};
|
|
|
|
use App\Traits\PageTemplate;
|
|
|
|
|
|
|
|
class PacketPasswordInvalid extends Netmails
|
|
|
|
{
|
|
|
|
use PageTemplate;
|
|
|
|
|
|
|
|
private const LOGKEY = 'NPP';
|
|
|
|
|
|
|
|
private string $packet;
|
|
|
|
private string $invalidpass;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new notification instance.
|
|
|
|
*/
|
|
|
|
public function __construct(string $invalidpass,string $packet)
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$this->invalidpass = $invalidpass;
|
|
|
|
$this->packet = $packet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the mail representation of the notification.
|
2023-12-18 04:13:16 +00:00
|
|
|
*
|
|
|
|
* @param mixed $notifiable
|
|
|
|
* @throws \Exception
|
2023-07-23 07:27:52 +00:00
|
|
|
*/
|
2023-12-18 04:13:16 +00:00
|
|
|
public function toNetmail(object $notifiable): Netmail
|
2023-07-23 07:27:52 +00:00
|
|
|
{
|
2023-12-18 04:13:16 +00:00
|
|
|
$o = $this->setupNetmail($notifiable);
|
2023-07-23 07:27:52 +00:00
|
|
|
$ao = $notifiable->routeNotificationFor(static::via);
|
|
|
|
|
|
|
|
Log::info(sprintf('%s:+ Creating netmail to [%s] - system using invalid packet password',self::LOGKEY,$ao->ftn));
|
|
|
|
|
|
|
|
$o->subject = $this->invalidpass.':Incorrect Packet Password';
|
|
|
|
$o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE|Message::FLAG_PKTPASSWD|Message::FLAG_CRASH);
|
|
|
|
|
|
|
|
// Message
|
2023-11-17 10:12:08 +00:00
|
|
|
$msg = $this->page(FALSE,'badpass');
|
2023-07-23 07:27:52 +00:00
|
|
|
|
|
|
|
if ($this->invalidpass)
|
|
|
|
$msg->addText(
|
|
|
|
sprintf("Hi there,\r\r".
|
|
|
|
"You sent me a mail packet (%s) with the incorrect password \"%s\". It wasnt processed.\r\r"
|
|
|
|
,$this->packet,$this->invalidpass));
|
|
|
|
else
|
|
|
|
$msg->addText(
|
|
|
|
sprintf("Hi there,\r\r".
|
|
|
|
"You sent me a mail packet (%s) with no password? It wasnt processed.\r\r"
|
|
|
|
,$this->packet));
|
|
|
|
|
|
|
|
$msg->addText("Head over to the website if you dont know what your packet password should be :)\r");
|
|
|
|
|
|
|
|
$o->msg = $msg->render();
|
|
|
|
$o->tagline = 'Safety first, password second.';
|
|
|
|
|
|
|
|
$o->save();
|
|
|
|
|
|
|
|
return $o;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the array representation of the notification.
|
|
|
|
*
|
|
|
|
* @return array<string, mixed>
|
|
|
|
*/
|
|
|
|
public function toArray(object $notifiable): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
//
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|