Halte die Anmeldung auf der im Browser geöffneten Adresse.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
63f2be565f
commit
fa706e5080
7 files changed
+119
-3
No files matched your search
@@ -14,6 +14,42 @@ class AdministrationTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_guest_redirect_keeps_the_address_opened_in_the_browser(): void
|
||||
{
|
||||
config(['app.url' => 'https://CHANGE-ME.example']);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-Forwarded-Host' => '',
|
||||
'X-Forwarded-Port' => '',
|
||||
'X-Forwarded-Proto' => '',
|
||||
])->get('http://192.168.2.144:3011/verwaltung');
|
||||
|
||||
$response->assertRedirect('http://192.168.2.144:3011/verwaltung/login');
|
||||
|
||||
$intended = session('url.intended');
|
||||
$this->assertIsString($intended);
|
||||
$this->assertSame('192.168.2.144', parse_url($intended, PHP_URL_HOST));
|
||||
$this->assertSame(3011, parse_url($intended, PHP_URL_PORT));
|
||||
$this->assertSame('/verwaltung', parse_url($intended, PHP_URL_PATH));
|
||||
}
|
||||
|
||||
public function test_login_drops_an_intended_address_that_leaves_the_opened_host(): void
|
||||
{
|
||||
config(['app.url' => 'https://CHANGE-ME.example']);
|
||||
|
||||
$this->withSession(['url.intended' => 'http:///verwaltung'])
|
||||
->get('http://192.168.2.144:3011/verwaltung/login')
|
||||
->assertOk();
|
||||
|
||||
$this->assertNull(session('url.intended'));
|
||||
|
||||
$this->withSession(['url.intended' => 'http://192.168.2.144:3011/verwaltung'])
|
||||
->get('http://192.168.2.144:3011/verwaltung/login')
|
||||
->assertOk();
|
||||
|
||||
$this->assertSame('http://192.168.2.144:3011/verwaltung', session('url.intended'));
|
||||
}
|
||||
|
||||
public function test_guests_and_members_cannot_open_the_administration(): void
|
||||
{
|
||||
$this->get('/verwaltung')->assertRedirect('/verwaltung/login');
|
||||
|
||||
Reference in new issue
Block a user