Signiere Bestätigung und Ausgaben über den Pfad, damit der Port die Links nicht ungültig macht.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2113378e81
commit
63f2be565f
8 files changed
+69
-10
No files matched your search
@@ -9,9 +9,9 @@
|
||||
use App\Domain\Entitlement\Grant;
|
||||
use App\Domain\Entitlement\GrantStatus;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\SignedLink;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\View\View;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
@@ -56,7 +56,7 @@ public function show(Request $request, LicenseArticle $article): View
|
||||
'allowed' => $decision->allowed,
|
||||
'reason' => $decision->reason,
|
||||
'url' => $decision->allowed
|
||||
? URL::temporarySignedRoute('member.media', now()->addMinutes(10), [
|
||||
? SignedLink::temporary('member.media', now()->addMinutes(10), [
|
||||
'article' => $article->id,
|
||||
'release' => $release->id,
|
||||
'version' => $version->id,
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
class SignedLink
|
||||
{
|
||||
/**
|
||||
* Die Signatur gilt für den Pfad. Die Adresse davor darf der Port oder ein
|
||||
* Platzhalter sein, ohne dass der Link ungültig wird.
|
||||
*
|
||||
* @param array<string, mixed> $parameters
|
||||
*/
|
||||
public static function temporary(string $name, DateTimeInterface $expiration, array $parameters): string
|
||||
{
|
||||
return url(URL::temporarySignedRoute($name, $expiration, $parameters, false));
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
use App\Domain\Identity\Party;
|
||||
use App\Domain\Identity\StaffRole;
|
||||
use App\Domain\Identity\StaffRoleAssignment;
|
||||
use App\Notifications\VerifyEmailAddress;
|
||||
use Database\Factories\UserFactory;
|
||||
use Filament\Auth\MultiFactor\App\Concerns\InteractsWithAppAuthentication;
|
||||
use Filament\Auth\MultiFactor\App\Concerns\InteractsWithAppAuthenticationRecovery;
|
||||
@@ -42,6 +43,11 @@ protected function casts(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function sendEmailVerificationNotification(): void
|
||||
{
|
||||
$this->notify(new VerifyEmailAddress);
|
||||
}
|
||||
|
||||
public function party(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Party::class);
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Http\SignedLink;
|
||||
use Illuminate\Auth\Notifications\VerifyEmail;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
class VerifyEmailAddress extends VerifyEmail
|
||||
{
|
||||
protected function verificationUrl($notifiable): string
|
||||
{
|
||||
return SignedLink::temporary(
|
||||
'verification.verify',
|
||||
Carbon::now()->addMinutes((int) Config::get('auth.verification.expire', 60)),
|
||||
[
|
||||
'id' => $notifiable->getKey(),
|
||||
'hash' => sha1($notifiable->getEmailForVerification()),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user