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();