mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-07-05 15:10:16 +02:00
Fix Remember me (#111)
This commit is contained in:
@@ -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 }
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -3,39 +3,33 @@
|
|||||||
{% block title %}Log in{% endblock %}
|
{% block title %}Log in{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
{% if app.user %}
|
<form method="post">
|
||||||
|
<h1 class="py-2 h3 mb-3 font-weight-normal">{{ 'Please sign in'|trans }}</h1>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('tvdt_login_logout') }}">Logout</a>
|
<label for="username" class="form-label">{{ 'Email'|trans }}</label>
|
||||||
|
<input type="email" value="{{ last_username }}" name="_username" id="username" class="form-control"
|
||||||
|
autocomplete="email" required autofocus>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
|
||||||
<form method="post">
|
|
||||||
<h1 class="py-2 h3 mb-3 font-weight-normal">{{ 'Please sign in'|trans }}</h1>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="username" class="form-label">{{ 'Email'|trans }}</label>
|
|
||||||
<input type="email" value="{{ last_username }}" name="_username" id="username" class="form-control"
|
|
||||||
autocomplete="email" required autofocus>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="password" class="form-label">{{ 'Password'|trans }}</label>
|
<label for="password" class="form-label">{{ 'Password'|trans }}</label>
|
||||||
<input type="password" name="_password" id="password" class="form-control"
|
<input type="password" name="_password" id="password" class="form-control"
|
||||||
autocomplete="current-password"
|
autocomplete="current-password"
|
||||||
required>
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="_csrf_token" data-controller="csrf-protection"
|
<input type="hidden" name="_csrf_token" data-controller="csrf-protection"
|
||||||
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>
|
||||||
|
|
||||||
<button class="btn btn-lg btn-primary" type="submit">
|
<button class="btn btn-lg btn-primary" type="submit">
|
||||||
{{ 'Sign in'|trans }}
|
{{ 'Sign in'|trans }}
|
||||||
</button>
|
</button>
|
||||||
<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 %}
|
||||||
|
|||||||
Reference in New Issue
Block a user