Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Latest

## Fixes
* [#89](https://github.com/cleverage/ui-process-bundle/issues/89) `ProcessConfigurationsManager`: resolve the `ui.default` option with a normalizer instead of nested options defined with `setDefault()` (deprecated since symfony/options-resolver 7.3, removed in 8.0). With Symfony 8, a process launched with the UI form (`ui_launch_mode: form`) without `ui.default` no longer fails (`Cannot use object of type Closure as array`), and `ui.default` is validated again. Add tests.
* [#91](https://github.com/cleverage/ui-process-bundle/issues/91) `LoginController`: pass `error` and `last_username` (`AuthenticationUtils`) to the login template, so that a failed login displays the error message and keeps the email. Test updated.

v3.0.2
------
Expand Down
5 changes: 4 additions & 1 deletion src/Controller/Admin/Security/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;

class LoginController extends AbstractController
{
#[Route('/process/login', name: 'process_login')]
public function __invoke(): Response
public function __invoke(AuthenticationUtils $authenticationUtils): Response
{
return $this->render(
'@CleverAgeUiProcess/admin/login.html.twig',
[
'page_title' => 'Login',
'target_path' => '/process',
'error' => $authenticationUtils->getLastAuthenticationError(),
'last_username' => $authenticationUtils->getLastUsername(),
]
);
}
Expand Down
4 changes: 4 additions & 0 deletions tests/Functional/SecurityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ public function testLoginWithAnInvalidPassword(): void
$this->client->submit($form);

self::assertResponseRedirects('http://localhost/process/login');
$crawler = $this->client->followRedirect();
self::assertSelectorTextContains('.alert-danger', 'Invalid credentials.');
self::assertSame('admin@example.com', $crawler->filter('#username')->attr('value'));

$this->client->request('GET', '/process');
self::assertResponseRedirects('http://localhost/process/login');
}
Expand Down
Loading