Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,20 @@ The templates are Vue files with Tailwind classes. Maizzle inlines the CSS and w
<Heading class="text-2xl font-semibold"><Raw>{{ $subject }}</Raw></Heading>
```

A notification then returns those views from `toMail()`:
Keyring sends the security notices itself, so the app only gives them their look. One callback in `KeyringServiceProvider` builds every notice from the one template:

```php
return (new MailMessage)->subject($this->subject())->view(
['html' => 'emails.keyring.notice', 'text' => 'emails.keyring.text.notice'],
['subject' => $this->subject(), 'intro' => $this->intro(), /* ... */],
);
SecurityNotice::toMailUsing(fn (SecurityNotice $notice, object $notifiable) => (new MailMessage)
->subject($notice->subject())
->view(
['html' => 'emails.keyring.notice', 'text' => 'emails.keyring.text.notice'],
['subject' => $notice->subject(), 'intro' => $notice->intro(), /* ... */],
));
```

Blade escapes what the HTML views print, so a name someone typed for their security key can't add a link to a genuine security email. The twelve security notices share one template through `SecurityNotice::toMail()`; each notice class only says its subject and intro.
The five emails a flow needs (the emailed code, the two for an email change, and the two that answer an address that's already taken) each have their own template, so they're the app's own classes in `app/Notifications/Keyring`, registered with `Keyring::notifications()`.

Blade escapes what the HTML views print, so a name someone typed for their security key can't add a link to a genuine security email.

## Demo accounts

Expand Down
23 changes: 0 additions & 23 deletions app/Notifications/Keyring/AccountLocked.php

This file was deleted.

18 changes: 0 additions & 18 deletions app/Notifications/Keyring/AuthenticatorAdded.php

This file was deleted.

18 changes: 0 additions & 18 deletions app/Notifications/Keyring/AuthenticatorRemoved.php

This file was deleted.

18 changes: 0 additions & 18 deletions app/Notifications/Keyring/CloneSuspected.php

This file was deleted.

5 changes: 2 additions & 3 deletions app/Notifications/Keyring/EmailChangeNotice.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Notifications\Keyring;

use App\Support\SupportContact;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

Expand All @@ -15,8 +16,6 @@
*/
class EmailChangeNotice extends Notification
{
use ShowsSupportContact;

/**
* @param string $email the new address, with most of its name hidden
* @param string|null $contact "support_contact" from config/keyring.php: a URL or an address
Expand All @@ -42,7 +41,7 @@ public function toMail(object $notifiable): MailMessage
'email' => $this->email,
'revertUrl' => $this->revertUrl,
'confirmUrl' => $this->confirmUrl,
...$this->supportContact(),
...SupportContact::for($this->contact),
]);
}
}
18 changes: 0 additions & 18 deletions app/Notifications/Keyring/EmailChangeReverted.php

This file was deleted.

18 changes: 0 additions & 18 deletions app/Notifications/Keyring/EmailChanged.php

This file was deleted.

23 changes: 0 additions & 23 deletions app/Notifications/Keyring/NewDevice.php

This file was deleted.

18 changes: 0 additions & 18 deletions app/Notifications/Keyring/PasswordChanged.php

This file was deleted.

18 changes: 0 additions & 18 deletions app/Notifications/Keyring/RecoveryCodeUsed.php

This file was deleted.

18 changes: 0 additions & 18 deletions app/Notifications/Keyring/RecoveryCodesGenerated.php

This file was deleted.

18 changes: 0 additions & 18 deletions app/Notifications/Keyring/SecondFactorFailed.php

This file was deleted.

85 changes: 0 additions & 85 deletions app/Notifications/Keyring/SecurityNotice.php

This file was deleted.

34 changes: 0 additions & 34 deletions app/Notifications/Keyring/ShowsSupportContact.php

This file was deleted.

Loading