Fix Remember me (#111)

This commit is contained in:
2026-05-21 21:38:31 +02:00
committed by GitHub
parent 182353e2eb
commit 03425024fe
4 changed files with 27 additions and 31 deletions
View File
+3
View File
@@ -24,6 +24,9 @@ security:
default_target_path: tvdt_backoffice_index default_target_path: tvdt_backoffice_index
logout: logout:
path: tvdt_login_logout path: tvdt_login_logout
remember_me:
secret: '%kernel.secret%'
lifetime: 604800 # 1 week in seconds
access_control: access_control:
- { path: ^/admin, roles: ROLE_ADMIN } - { path: ^/admin, roles: ROLE_ADMIN }
-1
View File
@@ -8,7 +8,6 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\AsController; use Symfony\Component\HttpKernel\Attribute\AsController;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
use Tvdt\Enum\FlashType; use Tvdt\Enum\FlashType;
+1 -7
View File
@@ -3,11 +3,6 @@
{% block title %}Log in{% endblock %} {% block title %}Log in{% endblock %}
{% block body %} {% block body %}
{% if app.user %}
<div class="mb-3">
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('tvdt_login_logout') }}">Logout</a>
</div>
{% else %}
<form method="post"> <form method="post">
<h1 class="py-2 h3 mb-3 font-weight-normal">{{ 'Please sign in'|trans }}</h1> <h1 class="py-2 h3 mb-3 font-weight-normal">{{ 'Please sign in'|trans }}</h1>
<div class="mb-3"> <div class="mb-3">
@@ -27,7 +22,7 @@
value="{{ csrf_token('authenticate') }}"> value="{{ csrf_token('authenticate') }}">
<div class="mb-3 form-check"> <div class="mb-3 form-check">
<input type="checkbox" name="_remember_me" id="_remember_me" class="form-check-input"> <input type="checkbox" name="_remember_me" id="_remember_me" class="form-check-input" checked>
<label for="_remember_me" class="form-check-label">{{ 'Remember me'|trans }}</label> <label for="_remember_me" class="form-check-label">{{ 'Remember me'|trans }}</label>
</div> </div>
@@ -37,5 +32,4 @@
<a href="{{ path('tvdt_register') }}" <a href="{{ path('tvdt_register') }}"
class="btn btn-link">{{ 'Create an account'|trans }}</a> class="btn btn-link">{{ 'Create an account'|trans }}</a>
</form> </form>
{% endif %}
{% endblock %} {% endblock %}