Multiple enhancements to interactive messages, moved messages to Notifications, send netmail back when invalid packet password
This commit is contained in:
69
app/Notifications/Netmails/AddressLink.php
Normal file
69
app/Notifications/Netmails/AddressLink.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications\Netmails;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\FTN\Message;
|
||||
use App\Notifications\Netmails;
|
||||
use App\Models\{Netmail,System,User};
|
||||
use App\Traits\PageTemplate;
|
||||
|
||||
class AddressLink extends Netmails
|
||||
{
|
||||
use PageTemplate;
|
||||
|
||||
private const LOGKEY = 'NAL';
|
||||
private User $uo;
|
||||
|
||||
/**
|
||||
* Create a netmail to enable a sysop to activate an address.
|
||||
*
|
||||
* @param User $uo
|
||||
*/
|
||||
public function __construct(User $uo)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->uo = $uo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param System $so
|
||||
* @param mixed $notifiable
|
||||
* @return Netmail
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function toNetmail(System $so,object $notifiable): Netmail
|
||||
{
|
||||
$o = $this->setupNetmail($so,$notifiable);
|
||||
$ao = $notifiable->routeNotificationFor(static::via);
|
||||
|
||||
Log::info(sprintf('%s:+ Sending a link code for address [%s]',self::LOGKEY,$ao->ftn));
|
||||
|
||||
$o->subject = 'Address Link Code';
|
||||
$o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE|Message::FLAG_CRASH);
|
||||
|
||||
// Message
|
||||
$msg = $this->page(TRUE,'#link');
|
||||
|
||||
$msg->addText(sprintf(
|
||||
"Hi %s,\r\r".
|
||||
"This message is to link your address [%s] to your user ID in the Clearing Houz web site.\r\r".
|
||||
"If you didnt start this process, then you can safely ignore this netmail. But if you wanted to link this address, please head over to [%s] and paste in the following:\r\r%s\r",
|
||||
$ao->system->sysop,
|
||||
$ao->ftn3d,
|
||||
url('/link'),
|
||||
$ao->set_activation($this->uo)
|
||||
));
|
||||
|
||||
$o->msg = $msg->render();
|
||||
$o->tagline = 'Address Linking...';
|
||||
|
||||
$o->save();
|
||||
|
||||
return $o;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user