From 17db4962c45e59efe845c503c2cda39ec190df70 Mon Sep 17 00:00:00 2001 From: Jonathan van Rij Date: Thu, 19 Mar 2026 14:24:48 +0100 Subject: [PATCH] This commit makes sure that the test URL is renamed to the general login URL for local development and only works in local development. --- routes/web.php | 14 ++++++++------ tests/Feature/AuthTest.php | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/routes/web.php b/routes/web.php index 6e40cad..eb2a5a8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -35,11 +35,13 @@ }); }); -// Dev auto-login route -Route::get('/login-for-testing', function () { - $user = \App\Models\User::where('username', 'jonathan.van.rij@agerion.nl')->first(); +// Dev auto-login route (local and testing environments only) +if (app()->environment(['local', 'testing'])) { + Route::get('/login-jonathan', function () { + $user = \App\Models\User::where('username', 'jonathan.van.rij@agerion.nl')->first(); - auth()->login($user); + auth()->login($user); - return redirect('/'); -}); + return redirect('/'); + }); +} diff --git a/tests/Feature/AuthTest.php b/tests/Feature/AuthTest.php index 909141d..80619a2 100644 --- a/tests/Feature/AuthTest.php +++ b/tests/Feature/AuthTest.php @@ -98,7 +98,7 @@ public function test_login_jonathan_works_in_testing_env(): void 'updated_at' => now(), ]); - $this->get('/login-for-testing') + $this->get('/login-jonathan') ->assertRedirect('/'); $user = User::where('username', 'jonathan.van.rij@agerion.nl')->first();