Skip to content

Commit

Permalink
EV-318: Refactored login form
Browse files Browse the repository at this point in the history
  • Loading branch information
cableman committed Nov 23, 2023
1 parent 8df8e34 commit 2352183
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 23 deletions.
19 changes: 17 additions & 2 deletions src/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Symfony\Component\Translation\TranslatableMessage;

class LoginController extends AbstractController
{
Expand All @@ -15,9 +16,23 @@ public function index(AuthenticationUtils $authenticationUtils): Response
$error = $authenticationUtils->getLastAuthenticationError();
$lastUsername = $authenticationUtils->getLastUsername();

return $this->render('login/index.html.twig', [
'last_username' => $lastUsername,
return $this->render('@EasyAdmin/page/login.html.twig', [
// parameters usually defined in Symfony login forms
'error' => $error,
'last_username' => $lastUsername,
'page_title' => 'Event database log in',
'csrf_token_intention' => 'authenticate',
'target_path' => $this->generateUrl('admin'),
'username_label' => new TranslatableMessage('login.user.mail'),
'password_label' => new TranslatableMessage('login.user.password'),
'sign_in_label' => new TranslatableMessage('login.label'),
// @TODO: build forgot password form.
//'forgot_password_enabled' => true,
//'forgot_password_path' => $this->generateUrl('...', ['...' => '...']),
//'forgot_password_label' => 'Forgot your password?',
'remember_me_enabled' => true,
'remember_me_checked' => true,
'remember_me_label' => new TranslatableMessage('login.page.remember'),
]);
}

Expand Down
21 changes: 0 additions & 21 deletions templates/login/index.html.twig

This file was deleted.

20 changes: 20 additions & 0 deletions translations/messages+intl-icu.da.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,26 @@
<source>admin.user.edited.updated</source>
<target state="needs-l10n">__admin.user.edited.updated</target>
</trans-unit>
<trans-unit id="SapGUZS" resname="login.page.title">
<source>login.page.title</source>
<target state="needs-l10n">__login.page.title</target>
</trans-unit>
<trans-unit id="zPof34." resname="login.user.mail">
<source>login.user.mail</source>
<target state="needs-l10n">__login.user.mail</target>
</trans-unit>
<trans-unit id="Ri3SpJz" resname="login.user.password">
<source>login.user.password</source>
<target state="needs-l10n">__login.user.password</target>
</trans-unit>
<trans-unit id="gP1oGEr" resname="login.label">
<source>login.label</source>
<target state="needs-l10n">__login.label</target>
</trans-unit>
<trans-unit id="Ixl_ubC" resname="login.page.remember">
<source>login.page.remember</source>
<target state="needs-l10n">__login.page.remember</target>
</trans-unit>
</body>
</file>
</xliff>
16 changes: 16 additions & 0 deletions translations/messages+intl-icu.en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,22 @@
<source>admin.user.edited.updated</source>
<target>Last updated</target>
</trans-unit>
<trans-unit id="zPof34." resname="login.user.mail">
<source>login.user.mail</source>
<target>Mail address</target>
</trans-unit>
<trans-unit id="Ri3SpJz" resname="login.user.password">
<source>login.user.password</source>
<target>Password</target>
</trans-unit>
<trans-unit id="gP1oGEr" resname="login.label">
<source>login.label</source>
<target>Log in</target>
</trans-unit>
<trans-unit id="Ixl_ubC" resname="login.page.remember">
<source>login.page.remember</source>
<target>Remember me</target>
</trans-unit>
</body>
</file>
</xliff>

0 comments on commit 2352183

Please sign in to comment.