Baue Links aus der aufgerufenen Adresse, solange die Anwendungsadresse der Platzhalter ist.
Deploy Test / test (push) Failing after 9s
Deploy Test / deploy (push) Skipped

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-15 09:11:26 +01:00
1 parent fef0ea2ac2
commit fe03b0804c
5 files changed
+50

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\URL;
use Symfony\Component\HttpFoundation\Response;
class UseRequestRootUrl
{
public function handle(Request $request, Closure $next): Response
{
$configured = parse_url((string) config('app.url'), PHP_URL_HOST);
if ($configured === 'CHANGE-ME.example' && $request->getHost() !== '') {
URL::forceRootUrl($request->getSchemeAndHttpHost());
}
return $next($request);
}
}
+2
View File
@@ -1,5 +1,6 @@
<?php
use App\Http\Middleware\UseRequestRootUrl;
use App\Http\Middleware\UseStaffSessionCookie;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
@@ -15,6 +16,7 @@
->withMiddleware(function (Middleware $middleware): void {
$middleware->trustProxies(at: '*');
$middleware->prepend(UseStaffSessionCookie::class);
$middleware->prepend(UseRequestRootUrl::class);
$middleware->redirectGuestsTo(function (Request $request) {
if ($request->is('verwaltung', 'verwaltung/*')) {
return '/verwaltung/login';
+3
View File
@@ -8,6 +8,9 @@ APP_DEBUG=false
APP_NAME="Lara und Felix"
# erzeugen mit: php artisan key:generate --show
APP_KEY=
# Adresse, unter der diese Instanz im Browser erreichbar ist.
# Test derzeit: http://192.168.2.144:3011. Steht hier der Platzhalter,
# nutzt die App für Anfragen die Adresse des Browsers.
APP_URL=https://CHANGE-ME.example
DB_CONNECTION=pgsql
+2
View File
@@ -13,6 +13,8 @@ ## Bedienbar
Der Systemverwalter vergibt diese Rollen und kann sie dem eigenen Konto geben. Ein Konto darf mehrere Rollen tragen.
Auf der Testinstanz steht `APP_URL` noch auf dem Platzhalter. Solange das so ist, baut die Anwendung Links aus der Adresse, die der Browser tatsächlich geöffnet hat.
## Testdaten
`DemoCatalogSeeder` legt auf der Testumgebung Merkblatt, verschachtelte Übung, zwei Pakete, ein kostenloses Angebot und den Testkauf „Testkauf Programm“ für 5,00 € an. Der Betrag ist eine Erprobungsmarke, keine Preisentscheidung. Der Seeder läuft nur bei `LUF_ENV=test` und legt nichts ein zweites Mal an.
+21
View File
@@ -50,6 +50,27 @@ public function test_registration_creates_a_person_and_sends_verification(): voi
Notification::assertSentTo($user, VerifyEmail::class);
}
public function test_placeholder_app_url_uses_the_address_opened_in_the_browser(): void
{
Notification::fake();
config(['app.url' => 'https://CHANGE-ME.example']);
$response = $this->post('/registrieren', [
'name' => 'Probe Mitglied',
'email' => 'probe@example.test',
'password' => 'password-pass',
'password_confirmation' => 'password-pass',
'adult' => '1',
]);
$response->assertRedirect('http://localhost:8000/email/bestaetigen');
$user = User::query()->where('email', 'probe@example.test')->firstOrFail();
Notification::assertSentTo($user, VerifyEmail::class, function (VerifyEmail $notification) use ($user): bool {
return str_contains($notification->toMail($user)->actionUrl, 'http://localhost:8000/email/bestaetigen/');
});
}
public function test_verified_member_can_log_in_and_reaches_the_dashboard(): void
{
$user = User::factory()->create([