Skip to content

Commit

Permalink
Merge pull request #751 from stefanorosanelli/fix/login-redirect
Browse files Browse the repository at this point in the history
fix: use `?` in route array
  • Loading branch information
didoda authored Apr 7, 2022
2 parents e3002a4 + 5ada910 commit fb98120
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected function loginRedirectRoute(): array
return $route;
}

return $route + compact('redirect');
return $route + ['?' => compact('redirect')];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Template/Pages/Login/login.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="login-form">

{{ Form.create(null, {
'url': {'_name': 'login', 'redirect': _view.request.getQuery('redirect') },
'url': {'_name': 'login', '?': {'redirect': _view.request.getQuery('redirect')}},
})|raw }}

{% if projects %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public function findProvider(): array
'publish_end' => null,
],
'id' => '1',
'tokens' => [],
],
],
];
Expand All @@ -104,11 +103,6 @@ public function testFind(array $credentials, ?array $expected): void
$resolver = new ApiResolver();
$identity = $resolver->find($credentials);

if (isset($expected['tokens'])) {
$client = ApiClientProvider::getApiClient();
$expected['tokens'] = $client->getTokens();
}

if ($expected === null) {
static::assertNull($identity);

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Controller/AppControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public function loginRedirectRouteProvider(): array
],
'redirect to /' => [
['environment' => ['REQUEST_METHOD' => 'GET'], 'params' => ['object_type' => 'documents']], // config
['_name' => 'login', 'redirect' => '/'], // expected
['_name' => 'login', '?' => ['redirect' => '/']], // expected
],
];
}
Expand Down

0 comments on commit fb98120

Please sign in to comment.