From 652a643a203dd60065227aa2be728320021fbaac Mon Sep 17 00:00:00 2001 From: redone Date: Mon, 18 Jul 2022 11:50:23 +0100 Subject: [PATCH] add login redirect function --- README.md | 6 +++--- src/Twig/LoginFormExtension.php | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d72b01a..4547dc0 100644 --- a/README.md +++ b/README.md @@ -183,9 +183,9 @@ For logging in: | ------------- |:-------------:| | `login_form_username` | Renders the username field | | `login_form_password` | Renders the password field | -| `registration_form_csrf` | Renders a hidden field that contains a CSRF token. | -| `registration_form_submit` | Renders the submit button | - +| `login_form_csrf` | Renders a hidden field that contains a CSRF token. | +| `login_form_submit` | Renders the submit button | +| `login_redirect_url` | redirect to "/" after submit | Each field function above takes an optional `withlabel` argument and the `labels` argument that is also used by `registration_form`. diff --git a/src/Twig/LoginFormExtension.php b/src/Twig/LoginFormExtension.php index a8dd244..2e0e48e 100644 --- a/src/Twig/LoginFormExtension.php +++ b/src/Twig/LoginFormExtension.php @@ -48,6 +48,7 @@ public function getFunctions(): array new TwigFunction('login_form_password', [$this, 'getPasswordField'], $safe), new TwigFunction('login_form_csrf', [$this, 'getCsrfField'], $safe), new TwigFunction('login_form_submit', [$this, 'getSubmitButton'], $safe), + new TwigFunction('login_redirect_url', [$this, 'getRedirectField'], $safe), ]; }