Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix appeal custom login page not showing up #390

Merged
merged 2 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/lang/en/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
40 changes: 40 additions & 0 deletions tests/Feature/Appeal/AppealLoginPageTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace Tests\Feature\Appeal;

use App\Models\Appeal;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\TestCase;
use Tests\Traits\TestHasUsers;

class AppealLoginPageTest extends TestCase
{
use DatabaseMigrations;
use TestHasUsers;

public function test_admin_doesnt_see_login_page_when_viewing_appeal()
{
$appeal = Appeal::factory()->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');
}
}