mirror of
https://forge.chapril.org/tykayn/caisse-bliss
synced 2025-10-04 17:04:54 +02:00
ability to login restored
This commit is contained in:
parent
d01ecdabba
commit
7ad6f2d823
5 changed files with 118 additions and 116 deletions
|
@ -19,16 +19,20 @@ security:
|
||||||
security: false
|
security: false
|
||||||
main:
|
main:
|
||||||
form_login:
|
form_login:
|
||||||
# "app_login" is the name of the route created previously
|
|
||||||
login_path: app_login
|
login_path: app_login
|
||||||
check_path: app_login
|
check_path: app_login
|
||||||
# access_token:
|
enable_csrf: true
|
||||||
# token_handler: App\Security\AccessTokenHandler
|
logout:
|
||||||
|
path: app_logout
|
||||||
|
# where to redirect after logout
|
||||||
|
# target: app_any_route
|
||||||
|
|
||||||
# Contrôle d'accès
|
# Contrôle d'accès
|
||||||
access_control:
|
access_control:
|
||||||
- { path: ^/admin, roles: ROLE_ADMIN }
|
- { path: ^/admin, roles: ROLE_ADMIN }
|
||||||
- { path: ^/logged, roles: ROLE_USER }
|
- { path: ^/logged, roles: ROLE_USER }
|
||||||
|
- { path: ^/docs, roles: PUBLIC_ACCESS } # Allows accessing the Swagger UI
|
||||||
|
- { path: ^/authentication_token, roles: PUBLIC_ACCESS }
|
||||||
# - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } # Autoriser l'accès à la page de connexion
|
# - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } # Autoriser l'accès à la page de connexion
|
||||||
# - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY } # Autoriser l'accès anonyme à toutes les autres pages
|
# - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY } # Autoriser l'accès anonyme à toutes les autres pages
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace App\Controller;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||||
|
|
||||||
class SecurityController extends AbstractController
|
class SecurityController extends AbstractController
|
||||||
|
@ -25,9 +25,8 @@ class SecurityController extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route(path: '/logout', name: 'app_logout')]
|
#[Route(path: '/logout', name: 'app_logout')]
|
||||||
public function logout(): Response
|
public function logout(): void
|
||||||
{
|
{
|
||||||
return $this->redirectToRoute('app_default');
|
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,91 +25,91 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="btn {% if app.request.attributes.get('_route') == 'productcategory_index' %}
|
{# <a class="btn {% if app.request.attributes.get('_route') == 'productcategory_index' %}#}
|
||||||
btn-success
|
{# btn-success#}
|
||||||
{% else %}
|
{# {% else %}#}
|
||||||
btn-default
|
{# btn-default#}
|
||||||
{% endif %} "
|
{# {% endif %} "#}
|
||||||
href="{{ path('productcategory_index') }}">
|
{# href="{{ path('productcategory_index') }}">#}
|
||||||
<i class="fa fa-file-archive-o"></i>
|
{# <i class="fa fa-file-archive-o"></i>#}
|
||||||
{% trans %}menu.categories{% endtrans %}
|
{# {% trans %}menu.categories{% endtrans %}#}
|
||||||
<span class="badge">
|
{# <span class="badge">#}
|
||||||
{{ app.user.categories|length }}
|
{# {{ app.user.categories|length }}#}
|
||||||
</span>
|
{# </span>#}
|
||||||
</a>
|
{# </a>#}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="btn {% if app.request.attributes.get('_route') == 'product_index' %}
|
{# <a class="btn {% if app.request.attributes.get('_route') == 'product_index' %}#}
|
||||||
btn-success
|
{# btn-success#}
|
||||||
{% else %}
|
{# {% else %}#}
|
||||||
btn-default
|
{# btn-default#}
|
||||||
{% endif %} "
|
{# {% endif %} "#}
|
||||||
href="{{ path('product_index') }}"
|
{# href="{{ path('product_index') }}"#}
|
||||||
>
|
{# >#}
|
||||||
<i class="fa fa-gears"></i>
|
{# <i class="fa fa-gears"></i>#}
|
||||||
{% trans %}menu.products{% endtrans %}
|
{# {% trans %}menu.products{% endtrans %}#}
|
||||||
<span class="badge">
|
{# <span class="badge">#}
|
||||||
{{ app.user.products|length }}
|
{# {{ app.user.products|length }}#}
|
||||||
</span>
|
{# </span>#}
|
||||||
</a>
|
{# </a>#}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a id="menu_festivals"
|
{# <a id="menu_festivals"#}
|
||||||
class="btn {% if app.request.attributes.get('_route') == 'festival_index' %}
|
{# class="btn {% if app.request.attributes.get('_route') == 'festival_index' %}#}
|
||||||
btn-success
|
{# btn-success#}
|
||||||
{% else %}
|
{# {% else %}#}
|
||||||
btn-default
|
{# btn-default#}
|
||||||
{% endif %}
|
{# {% endif %}#}
|
||||||
" href='{{ path('festival_index') }}'
|
{# " href='{{ path('festival_index') }}'#}
|
||||||
>
|
{# >#}
|
||||||
<i class="fa fa-th-large"></i>
|
{# <i class="fa fa-th-large"></i>#}
|
||||||
|
|
||||||
{% trans %}menu.festivals{% endtrans %}
|
{# {% trans %}menu.festivals{% endtrans %}#}
|
||||||
<span class="badge">
|
{# <span class="badge">#}
|
||||||
{{ app.user.festivals|length }}
|
{# {{ app.user.festivals|length }}#}
|
||||||
</span>
|
{# </span>#}
|
||||||
</a>
|
{# </a>#}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a id="menu_series"
|
{# <a id="menu_series"#}
|
||||||
class="btn {% if app.request.attributes.get('_route') == 'seriefestival_index' %}
|
{# class="btn {% if app.request.attributes.get('_route') == 'seriefestival_index' %}#}
|
||||||
btn-success
|
{# btn-success#}
|
||||||
{% else %}
|
{# {% else %}#}
|
||||||
btn-default
|
{# btn-default#}
|
||||||
{% endif %}
|
{# {% endif %}#}
|
||||||
" href='{{ path('seriefestival_index') }}'
|
{# " href='{{ path('seriefestival_index') }}'#}
|
||||||
>
|
{# >#}
|
||||||
<i class="fa fa-th-large"></i>
|
{# <i class="fa fa-th-large"></i>#}
|
||||||
|
|
||||||
{% trans %}menu.series{% endtrans %}
|
{# {% trans %}menu.series{% endtrans %}#}
|
||||||
<span class="badge">
|
{# <span class="badge">#}
|
||||||
{{ app.user.seriesFestivals|length }}
|
{# {{ app.user.seriesFestivals|length }}#}
|
||||||
</span>
|
{# </span>#}
|
||||||
</a>
|
{# </a>#}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="btn {% if app.request.attributes.get('_route') == 'history' %}
|
{# <a class="btn {% if app.request.attributes.get('_route') == 'history' %}#}
|
||||||
btn-success
|
{# btn-success#}
|
||||||
{% else %}
|
{# {% else %}#}
|
||||||
btn-default
|
{# btn-default#}
|
||||||
{% endif %}" href="{{ path('history') }}"
|
{# {% endif %}" href="{{ path('history') }}"#}
|
||||||
>
|
{# >#}
|
||||||
<i class="fa fa-clock-o"></i>
|
{# <i class="fa fa-clock-o"></i>#}
|
||||||
{% trans %}menu.history{% endtrans %}
|
{# {% trans %}menu.history{% endtrans %}#}
|
||||||
</a>
|
{# </a>#}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|
||||||
<a class="btn {% if app.request.attributes.get('_route') == 'import' %}
|
{# <a class="btn {% if app.request.attributes.get('_route') == 'import' %}#}
|
||||||
btn-success
|
{# btn-success#}
|
||||||
{% else %}
|
{# {% else %}#}
|
||||||
btn-default
|
{# btn-default#}
|
||||||
{% endif %}" href="{{ path('import') }}"
|
{# {% endif %}" href="{{ path('import') }}"#}
|
||||||
>
|
{# >#}
|
||||||
<i class="fa fa-arrow-circle-o-up"></i>
|
{# <i class="fa fa-arrow-circle-o-up"></i>#}
|
||||||
|
|
||||||
{% trans %}menu.import{% endtrans %}
|
{# {% trans %}menu.import{% endtrans %}#}
|
||||||
</a>
|
{# </a>#}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@
|
||||||
{# {% trans %}menu.introjs{% endtrans %}#}
|
{# {% trans %}menu.introjs{% endtrans %}#}
|
||||||
Visite guidée
|
Visite guidée
|
||||||
</a>
|
</a>
|
||||||
{% if app.user.username == 'demo' %}
|
{% if app.user.name == 'demo' %}
|
||||||
<div class="text-warning alert-sm marged ">
|
<div class="text-warning alert-sm marged ">
|
||||||
<i class="fa fa-info-circle"></i>
|
<i class="fa fa-info-circle"></i>
|
||||||
<sub> Ceci est un compte de démonstration. Créez votre compte personnel dès
|
<sub> Ceci est un compte de démonstration. Créez votre compte personnel dès
|
||||||
|
@ -153,7 +153,7 @@
|
||||||
{% trans %}user.greet{% endtrans %}
|
{% trans %}user.greet{% endtrans %}
|
||||||
<a href="#" class="user-info-link">
|
<a href="#" class="user-info-link">
|
||||||
<i class="fa fa-user"></i>
|
<i class="fa fa-user"></i>
|
||||||
{{ app.user.username }}
|
{{ app.user.name }}
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
|
|
|
|
||||||
|
|
|
@ -3,40 +3,39 @@
|
||||||
{% block title %}Log in!{% endblock %}
|
{% block title %}Log in!{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{% if error %}
|
{% if error %}
|
||||||
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if app.user %}
|
{% if app.user %}
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('app_logout') }}">Logout</a>
|
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('app_logout') }}">Logout</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
|
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
|
||||||
<label for="inputUsername">Username</label>
|
<label for="username">Email</label>
|
||||||
<input type="text" value="{{ last_username }}" name="username" id="inputUsername" class="form-control" autocomplete="username" required autofocus>
|
<input type="email" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="email" required autofocus>
|
||||||
<label for="inputPassword">Password</label>
|
<label for="password">Password</label>
|
||||||
<input type="password" name="password" id="inputPassword" class="form-control" autocomplete="current-password" required>
|
<input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
|
||||||
|
|
||||||
<input type="hidden" name="_csrf_token"
|
<input type="hidden" name="_csrf_token"
|
||||||
value="{{ csrf_token('authenticate') }}"
|
value="{{ csrf_token('authenticate') }}"
|
||||||
>
|
>
|
||||||
|
|
||||||
{#
|
{#
|
||||||
Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.
|
Uncomment this section and add a remember_me option below your firewall to activate remember me functionality.
|
||||||
See https://symfony.com/doc/current/security/remember_me.html
|
See https://symfony.com/doc/current/security/remember_me.html
|
||||||
|
|
||||||
<div class="checkbox mb-3">
|
<div class="checkbox mb-3">
|
||||||
<label>
|
<input type="checkbox" name="_remember_me" id="_remember_me">
|
||||||
<input type="checkbox" name="_remember_me"> Remember me
|
<label for="_remember_me">Remember me</label>
|
||||||
</label>
|
</div>
|
||||||
</div>
|
#}
|
||||||
#}
|
|
||||||
|
|
||||||
<button class="btn btn-lg btn-primary" type="submit">
|
<button class="btn btn-lg btn-primary" type="submit">
|
||||||
Sign in
|
Sign in
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -17,12 +17,12 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
{# <li>#}
|
||||||
<a class="btn btn-primary" href="{{ path('productcategory_index') }}"> <i class="fa fa-arrow-left"></i>Retour à la liste</a>
|
{# <a class="btn btn-primary" href="{{ path('productcategory_index') }}"> <i class="fa fa-arrow-left"></i>Retour à la liste</a>#}
|
||||||
</li>
|
{# </li>#}
|
||||||
<li>
|
{# <li>#}
|
||||||
<a class="btn btn-primary" href="{{ path('productcategory_edit', { 'id': productCategory.id }) }}">edit</a>
|
{# <a class="btn btn-primary" href="{{ path('productcategory_edit', { 'id': productCategory.id }) }}">edit</a>#}
|
||||||
</li>
|
{# </li>#}
|
||||||
<li>
|
<li>
|
||||||
{{ form_start(delete_form) }}
|
{{ form_start(delete_form) }}
|
||||||
<input type="submit" value="Delete">
|
<input type="submit" value="Delete">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue