From 5704d0fb5825a2f1abe1b41304cb38041c970de0 Mon Sep 17 00:00:00 2001 From: Boban Blaskovic Date: Fri, 22 May 2026 14:46:26 +0200 Subject: [PATCH] fix: quick-login 500 + Vite asset https scheme (TDD) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BUG B — navigation.blade.php crashed on null auth()->user() for unauthenticated visitors of /dev/quick-login. Two-layer fix: - DevQuickLogin: add #[Layout('components.layouts.auth')] so page renders without the authenticated navigation bar - navigation.blade.php: null-safe ?-> on all auth()->user() calls (three occurrences: name, name again, email) as defense-in-depth BUG A — @vite() generated http:// asset URLs causing Mixed Content on HTTPS domain. Root cause: ASSET_URL removed but APP_URL changed to http://localhost by previous agent. Fixed: APP_URL restored to https://app.dev.lernschiff.com so URL::forceScheme('https') activates and assets render as https://app.dev.lernschiff.com/build/assets/*. TDD: test written → RED (500) → fix → GREEN. 46/46 pass. Co-Authored-By: Claude Sonnet 4.6 Co-Authored-By: Codex --- app/Livewire/DevQuickLogin.php | 4 +++- app/Providers/AppServiceProvider.php | 2 +- .../livewire/layout/navigation.blade.php | 6 +++--- .../DevQuickLogin/QuickLoginRendersTest.php | 21 +++++++++++++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 tests/Feature/DevQuickLogin/QuickLoginRendersTest.php diff --git a/app/Livewire/DevQuickLogin.php b/app/Livewire/DevQuickLogin.php index d1d5651..fa64441 100644 --- a/app/Livewire/DevQuickLogin.php +++ b/app/Livewire/DevQuickLogin.php @@ -3,8 +3,10 @@ namespace App\Livewire; use App\Models\User; +use Livewire\Attributes\Layout; use Livewire\Component; +#[Layout('components.layouts.auth')] class DevQuickLogin extends Component { public function loginAs(string $email): void @@ -22,4 +24,4 @@ class DevQuickLogin extends Component $users = User::withoutGlobalScopes()->get(['id', 'name', 'email', 'uuid']); return view('livewire.dev-quick-login', compact('users')); } -} +} \ No newline at end of file diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index f5a971b..47ca9c6 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -29,7 +29,7 @@ class AppServiceProvider extends ServiceProvider */ public function boot(): void { - if (app()->environment() !== 'testing') { + if (app()->environment() !== 'testing' && str_starts_with(config('app.url'), 'https')) { URL::forceScheme('https'); } diff --git a/resources/views/livewire/layout/navigation.blade.php b/resources/views/livewire/layout/navigation.blade.php index a06e223..6d8ccd0 100644 --- a/resources/views/livewire/layout/navigation.blade.php +++ b/resources/views/livewire/layout/navigation.blade.php @@ -41,7 +41,7 @@ new class extends Component