diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 0936e9ef..2394d207 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -19,16 +19,20 @@ security: security: false main: form_login: - # "app_login" is the name of the route created previously login_path: app_login check_path: app_login - # access_token: - # token_handler: App\Security\AccessTokenHandler + enable_csrf: true + logout: + path: app_logout + # where to redirect after logout + # target: app_any_route # Contrôle d'accès access_control: - { path: ^/admin, roles: ROLE_ADMIN } - { 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: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY } # Autoriser l'accès anonyme à toutes les autres pages diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index 7dd6e53d..76bf5c4f 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -4,7 +4,7 @@ namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; class SecurityController extends AbstractController @@ -25,9 +25,8 @@ class SecurityController extends AbstractController } #[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.'); } } diff --git a/templates/default/login-choices.html.twig b/templates/default/login-choices.html.twig index 06c22dde..83941cf3 100755 --- a/templates/default/login-choices.html.twig +++ b/templates/default/login-choices.html.twig @@ -25,91 +25,91 @@
  • - - - {% trans %}menu.categories{% endtrans %} - - {{ app.user.categories|length }} - - +{# #} +{# #} +{# {% trans %}menu.categories{% endtrans %}#} +{# #} +{# {{ app.user.categories|length }}#} +{# #} +{# #}
  • - - - {% trans %}menu.products{% endtrans %} - - {{ app.user.products|length }} - - +{# #} +{# #} +{# {% trans %}menu.products{% endtrans %}#} +{# #} +{# {{ app.user.products|length }}#} +{# #} +{# #}
  • - - +{# #} +{# #} - {% trans %}menu.festivals{% endtrans %} - - {{ app.user.festivals|length }} - - +{# {% trans %}menu.festivals{% endtrans %}#} +{# #} +{# {{ app.user.festivals|length }}#} +{# #} +{# #}
  • - - +{# #} +{# #} - {% trans %}menu.series{% endtrans %} - - {{ app.user.seriesFestivals|length }} - - +{# {% trans %}menu.series{% endtrans %}#} +{# #} +{# {{ app.user.seriesFestivals|length }}#} +{# #} +{# #}
  • - - - {% trans %}menu.history{% endtrans %} - +{# #} +{# #} +{# {% trans %}menu.history{% endtrans %}#} +{# #}
  • - - +{# #} +{# #} - {% trans %}menu.import{% endtrans %} - +{# {% trans %}menu.import{% endtrans %}#} +{# #}
  • @@ -131,7 +131,7 @@ {# {% trans %}menu.introjs{% endtrans %}#} Visite guidée - {% if app.user.username == 'demo' %} + {% if app.user.name == 'demo' %}
    Ceci est un compte de démonstration. Créez votre compte personnel dès @@ -153,7 +153,7 @@ {% trans %}user.greet{% endtrans %} | diff --git a/templates/security/login.html.twig b/templates/security/login.html.twig index 6c191545..07b5cd41 100644 --- a/templates/security/login.html.twig +++ b/templates/security/login.html.twig @@ -3,40 +3,39 @@ {% block title %}Log in!{% endblock %} {% block body %} -
    - {% if error %} -
    {{ error.messageKey|trans(error.messageData, 'security') }}
    - {% endif %} + + {% if error %} +
    {{ error.messageKey|trans(error.messageData, 'security') }}
    + {% endif %} - {% if app.user %} -
    - You are logged in as {{ app.user.userIdentifier }}, Logout -
    - {% endif %} + {% if app.user %} +
    + You are logged in as {{ app.user.userIdentifier }}, Logout +
    + {% endif %} -

    Please sign in

    - - - - +

    Please sign in

    + + + + - + - {# - 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 + {# + 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 -
    - -
    - #} +
    + + +
    + #} - -
    + + {% endblock %} diff --git a/templates/toMigrate/productcategory/show.html.twig b/templates/toMigrate/productcategory/show.html.twig index 8ea3e392..bdda60be 100755 --- a/templates/toMigrate/productcategory/show.html.twig +++ b/templates/toMigrate/productcategory/show.html.twig @@ -17,12 +17,12 @@