From 73d535278dc570d722976a1ffe35d1d5823e579a Mon Sep 17 00:00:00 2001 From: Petri Saarinen Date: Sun, 22 Nov 2026 10:28:58 +0200 Subject: [PATCH] Add local-only test login and Finnish pagination strings - /dev/login signs in a test user and returns to the requested page. It is registered only when APP_ENV=local and is named "login", so the auth middleware redirects there. It stands in for the real login, which arrives in phase 1. - Translate the Flux pagination summary and previous/next button labels into Finnish, so screen readers do not read English on Finnish pages. Co-Authored-By: Claude Opus 5.5 --- lang/fi.json | 6 ++++++ lang/fi/pagination.php | 6 ++++++ routes/web.php | 28 ++++++++++++++++++++++++++++ tests/Feature/LocalTestLoginTest.php | 10 ++++++++++ 4 files changed, 50 insertions(+) create mode 100644 lang/fi.json create mode 100644 lang/fi/pagination.php create mode 100644 tests/Feature/LocalTestLoginTest.php diff --git a/lang/fi.json b/lang/fi.json new file mode 100644 index 0000000..f6547b4 --- /dev/null +++ b/lang/fi.json @@ -0,0 +1,6 @@ +{ + "Showing": "Tulokset", + "to": "–", + "of": "/", + "results": "kpl" +} diff --git a/lang/fi/pagination.php b/lang/fi/pagination.php new file mode 100644 index 0000000..a4c4d34 --- /dev/null +++ b/lang/fi/pagination.php @@ -0,0 +1,6 @@ + 'Edellinen sivu', + 'next' => 'Seuraava sivu', +]; diff --git a/routes/web.php b/routes/web.php index 35a3cb8..955af75 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,33 @@ name('home'); + +/* +|-------------------------------------------------------------------------- +| Local test login +|-------------------------------------------------------------------------- +| +| Temporary stand-in for the real login, which arrives in phase 1. Exists +| only when APP_ENV=local: it signs in a test user and returns to the page +| that asked for login. Named "login" so the auth middleware redirects here. +| Remove it when the real login page is built. +| +*/ +if (app()->environment('local')) { + Route::get('/dev/login', function () { + $user = User::query()->firstOrCreate( + ['email' => 'testikayttaja@example.test'], + ['name' => 'Testikäyttäjä', 'password' => Str::password()], + ); + + Auth::login($user); + request()->session()->regenerate(); + + return redirect()->intended(route('customers.index')); + })->middleware('web')->name('login'); +} diff --git a/tests/Feature/LocalTestLoginTest.php b/tests/Feature/LocalTestLoginTest.php new file mode 100644 index 0000000..808a16b --- /dev/null +++ b/tests/Feature/LocalTestLoginTest.php @@ -0,0 +1,10 @@ +environment())->not->toBe('local') + ->and(Route::has('login'))->toBeFalse(); + + $this->get('/dev/login')->assertNotFound(); +});