From cb6226f35fbc8eab81e2d28f4c529e96a6842e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taavi=20V=C3=A4=C3=A4n=C3=A4nen?= Date: Thu, 10 Dec 2020 11:02:14 +0200 Subject: [PATCH] Fix appeal custom login page not showing up --- resources/lang/en/auth.php | 2 +- routes/web.php | 2 +- tests/Feature/Appeal/AppealLoginPageTest.php | 40 ++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 tests/Feature/Appeal/AppealLoginPageTest.php diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index 4bc69303..18392a51 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -2,7 +2,7 @@ return [ 'auth-needed-screen' => [ - 'title' => 'Authentication requred', + 'title' => 'Authentication required', 'text' => 'Please authenticate in order to access your appeal.', 'key-text' => 'Please enter your appeal key in the text box', 'key-placeholder' => 'Appeal key here', diff --git a/routes/web.php b/routes/web.php index 15df43f7..9279b72e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -30,7 +30,7 @@ Route::post('/appeal/verify/{appeal}', 'Appeal\PublicAppealController@verifyAccountOwnership')->name('public.appeal.verifyownership.submit'); }); -Route::get('/appeal/{id}', 'AppealController@appeal')->middleware('auth')->name('appeal.view'); +Route::get('/appeal/{id}', 'AppealController@appeal')->name('appeal.view'); Route::get('/review', 'AppealController@appeallist')->name('appeal.list'); Route::get('/locate', 'AppealController@search')->name('appeal.search'); diff --git a/tests/Feature/Appeal/AppealLoginPageTest.php b/tests/Feature/Appeal/AppealLoginPageTest.php new file mode 100644 index 00000000..6f4c360f --- /dev/null +++ b/tests/Feature/Appeal/AppealLoginPageTest.php @@ -0,0 +1,40 @@ +create(); + $user = $this->getUser(); + + $response = $this + ->actingAs($user) + ->get(route('appeal.view', $appeal)); + + $response + ->assertSee('Appeal for ') + ->assertDontSee('Authentication required'); + } + + public function test_logged_out_user_does_see_login_page() + { + $appeal = Appeal::factory()->create(); + + $response = $this + ->get(route('appeal.view', $appeal)); + + $response + ->assertDontSee('Appeal for ') + ->assertSee('Authentication required'); + } +}