40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|||
|
|
|
||
|
|
namespace Modules\Core\Auth\Mail;
|
||
|
|
|
||
|
|
use Illuminate\Mail\Mailable;
|
||
|
|
use Illuminate\Mail\Mailables\Content;
|
||
|
|
use Illuminate\Mail\Mailables\Envelope;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Sent to the OLD address once a login-email change actually takes
|
||
|
|
* effect (Customer\Services\CustomerEmailChangeService::confirm()) — lets
|
||
|
|
* the previous owner notice if someone else changed it from a hijacked
|
||
|
|
* session. Shows the new address masked (first character + domain only),
|
||
|
|
* never the full new address — this notice's whole point is alerting the
|
||
|
|
* OLD owner, not handing them the new address outright. View overridable
|
||
|
|
* per-app the same way UserOtpMail's is (resources/views/vendor/core/
|
||
|
|
* auth/mail/email-changed-notice.blade.php).
|
||
|
|
*/
|
||
|
|
class EmailChangedNoticeMail extends Mailable
|
||
|
|
{
|
||
|
|
public readonly string $maskedEmail;
|
||
|
|
|
||
|
|
public function __construct(string $newEmail)
|
||
|
|
{
|
||
|
|
[$local, $domain] = explode('@', $newEmail, 2);
|
||
|
|
|
||
|
|
$this->maskedEmail = mb_substr($local, 0, 1).'•••@'.$domain;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function envelope(): Envelope
|
||
|
|
{
|
||
|
|
return new Envelope(subject: 'Your account email was changed');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function content(): Content
|
||
|
|
{
|
||
|
|
return new Content(view: 'core::auth.mail.email-changed-notice');
|
||
|
|
}
|
||
|
|
}
|