mirror of
https://forge.chapril.org/tykayn/caisse-bliss
synced 2025-06-20 01:44:42 +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
|
||||
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
|
||||
|
||||
|
|
|
@ -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.');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,91 +25,91 @@
|
|||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn {% if app.request.attributes.get('_route') == 'productcategory_index' %}
|
||||
btn-success
|
||||
{% else %}
|
||||
btn-default
|
||||
{% endif %} "
|
||||
href="{{ path('productcategory_index') }}">
|
||||
<i class="fa fa-file-archive-o"></i>
|
||||
{% trans %}menu.categories{% endtrans %}
|
||||
<span class="badge">
|
||||
{{ app.user.categories|length }}
|
||||
</span>
|
||||
</a>
|
||||
{# <a class="btn {% if app.request.attributes.get('_route') == 'productcategory_index' %}#}
|
||||
{# btn-success#}
|
||||
{# {% else %}#}
|
||||
{# btn-default#}
|
||||
{# {% endif %} "#}
|
||||
{# href="{{ path('productcategory_index') }}">#}
|
||||
{# <i class="fa fa-file-archive-o"></i>#}
|
||||
{# {% trans %}menu.categories{% endtrans %}#}
|
||||
{# <span class="badge">#}
|
||||
{# {{ app.user.categories|length }}#}
|
||||
{# </span>#}
|
||||
{# </a>#}
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn {% if app.request.attributes.get('_route') == 'product_index' %}
|
||||
btn-success
|
||||
{% else %}
|
||||
btn-default
|
||||
{% endif %} "
|
||||
href="{{ path('product_index') }}"
|
||||
>
|
||||
<i class="fa fa-gears"></i>
|
||||
{% trans %}menu.products{% endtrans %}
|
||||
<span class="badge">
|
||||
{{ app.user.products|length }}
|
||||
</span>
|
||||
</a>
|
||||
{# <a class="btn {% if app.request.attributes.get('_route') == 'product_index' %}#}
|
||||
{# btn-success#}
|
||||
{# {% else %}#}
|
||||
{# btn-default#}
|
||||
{# {% endif %} "#}
|
||||
{# href="{{ path('product_index') }}"#}
|
||||
{# >#}
|
||||
{# <i class="fa fa-gears"></i>#}
|
||||
{# {% trans %}menu.products{% endtrans %}#}
|
||||
{# <span class="badge">#}
|
||||
{# {{ app.user.products|length }}#}
|
||||
{# </span>#}
|
||||
{# </a>#}
|
||||
</li>
|
||||
<li>
|
||||
<a id="menu_festivals"
|
||||
class="btn {% if app.request.attributes.get('_route') == 'festival_index' %}
|
||||
btn-success
|
||||
{% else %}
|
||||
btn-default
|
||||
{% endif %}
|
||||
" href='{{ path('festival_index') }}'
|
||||
>
|
||||
<i class="fa fa-th-large"></i>
|
||||
{# <a id="menu_festivals"#}
|
||||
{# class="btn {% if app.request.attributes.get('_route') == 'festival_index' %}#}
|
||||
{# btn-success#}
|
||||
{# {% else %}#}
|
||||
{# btn-default#}
|
||||
{# {% endif %}#}
|
||||
{# " href='{{ path('festival_index') }}'#}
|
||||
{# >#}
|
||||
{# <i class="fa fa-th-large"></i>#}
|
||||
|
||||
{% trans %}menu.festivals{% endtrans %}
|
||||
<span class="badge">
|
||||
{{ app.user.festivals|length }}
|
||||
</span>
|
||||
</a>
|
||||
{# {% trans %}menu.festivals{% endtrans %}#}
|
||||
{# <span class="badge">#}
|
||||
{# {{ app.user.festivals|length }}#}
|
||||
{# </span>#}
|
||||
{# </a>#}
|
||||
</li>
|
||||
<li>
|
||||
<a id="menu_series"
|
||||
class="btn {% if app.request.attributes.get('_route') == 'seriefestival_index' %}
|
||||
btn-success
|
||||
{% else %}
|
||||
btn-default
|
||||
{% endif %}
|
||||
" href='{{ path('seriefestival_index') }}'
|
||||
>
|
||||
<i class="fa fa-th-large"></i>
|
||||
{# <a id="menu_series"#}
|
||||
{# class="btn {% if app.request.attributes.get('_route') == 'seriefestival_index' %}#}
|
||||
{# btn-success#}
|
||||
{# {% else %}#}
|
||||
{# btn-default#}
|
||||
{# {% endif %}#}
|
||||
{# " href='{{ path('seriefestival_index') }}'#}
|
||||
{# >#}
|
||||
{# <i class="fa fa-th-large"></i>#}
|
||||
|
||||
{% trans %}menu.series{% endtrans %}
|
||||
<span class="badge">
|
||||
{{ app.user.seriesFestivals|length }}
|
||||
</span>
|
||||
</a>
|
||||
{# {% trans %}menu.series{% endtrans %}#}
|
||||
{# <span class="badge">#}
|
||||
{# {{ app.user.seriesFestivals|length }}#}
|
||||
{# </span>#}
|
||||
{# </a>#}
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn {% if app.request.attributes.get('_route') == 'history' %}
|
||||
btn-success
|
||||
{% else %}
|
||||
btn-default
|
||||
{% endif %}" href="{{ path('history') }}"
|
||||
>
|
||||
<i class="fa fa-clock-o"></i>
|
||||
{% trans %}menu.history{% endtrans %}
|
||||
</a>
|
||||
{# <a class="btn {% if app.request.attributes.get('_route') == 'history' %}#}
|
||||
{# btn-success#}
|
||||
{# {% else %}#}
|
||||
{# btn-default#}
|
||||
{# {% endif %}" href="{{ path('history') }}"#}
|
||||
{# >#}
|
||||
{# <i class="fa fa-clock-o"></i>#}
|
||||
{# {% trans %}menu.history{% endtrans %}#}
|
||||
{# </a>#}
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<a class="btn {% if app.request.attributes.get('_route') == 'import' %}
|
||||
btn-success
|
||||
{% else %}
|
||||
btn-default
|
||||
{% endif %}" href="{{ path('import') }}"
|
||||
>
|
||||
<i class="fa fa-arrow-circle-o-up"></i>
|
||||
{# <a class="btn {% if app.request.attributes.get('_route') == 'import' %}#}
|
||||
{# btn-success#}
|
||||
{# {% else %}#}
|
||||
{# btn-default#}
|
||||
{# {% endif %}" href="{{ path('import') }}"#}
|
||||
{# >#}
|
||||
{# <i class="fa fa-arrow-circle-o-up"></i>#}
|
||||
|
||||
{% trans %}menu.import{% endtrans %}
|
||||
</a>
|
||||
{# {% trans %}menu.import{% endtrans %}#}
|
||||
{# </a>#}
|
||||
</li>
|
||||
<li>
|
||||
|
||||
|
@ -131,7 +131,7 @@
|
|||
{# {% trans %}menu.introjs{% endtrans %}#}
|
||||
Visite guidée
|
||||
</a>
|
||||
{% if app.user.username == 'demo' %}
|
||||
{% if app.user.name == 'demo' %}
|
||||
<div class="text-warning alert-sm marged ">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
<sub> Ceci est un compte de démonstration. Créez votre compte personnel dès
|
||||
|
@ -153,7 +153,7 @@
|
|||
{% trans %}user.greet{% endtrans %}
|
||||
<a href="#" class="user-info-link">
|
||||
<i class="fa fa-user"></i>
|
||||
{{ app.user.username }}
|
||||
{{ app.user.name }}
|
||||
|
||||
</a>
|
||||
|
|
||||
|
|
|
@ -3,40 +3,39 @@
|
|||
{% block title %}Log in!{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<form method="post">
|
||||
{% if error %}
|
||||
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
||||
{% endif %}
|
||||
<form method="post">
|
||||
{% if error %}
|
||||
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.user %}
|
||||
<div class="mb-3">
|
||||
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('app_logout') }}">Logout</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if app.user %}
|
||||
<div class="mb-3">
|
||||
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('app_logout') }}">Logout</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
|
||||
<label for="inputUsername">Username</label>
|
||||
<input type="text" value="{{ last_username }}" name="username" id="inputUsername" class="form-control" autocomplete="username" required autofocus>
|
||||
<label for="inputPassword">Password</label>
|
||||
<input type="password" name="password" id="inputPassword" class="form-control" autocomplete="current-password" required>
|
||||
<h1 class="h3 mb-3 font-weight-normal">Please sign in</h1>
|
||||
<label for="username">Email</label>
|
||||
<input type="email" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="email" required autofocus>
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
|
||||
|
||||
<input type="hidden" name="_csrf_token"
|
||||
value="{{ csrf_token('authenticate') }}"
|
||||
>
|
||||
<input type="hidden" name="_csrf_token"
|
||||
value="{{ csrf_token('authenticate') }}"
|
||||
>
|
||||
|
||||
{#
|
||||
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
|
||||
|
||||
<div class="checkbox mb-3">
|
||||
<label>
|
||||
<input type="checkbox" name="_remember_me"> Remember me
|
||||
</label>
|
||||
</div>
|
||||
#}
|
||||
<div class="checkbox mb-3">
|
||||
<input type="checkbox" name="_remember_me" id="_remember_me">
|
||||
<label for="_remember_me">Remember me</label>
|
||||
</div>
|
||||
#}
|
||||
|
||||
<button class="btn btn-lg btn-primary" type="submit">
|
||||
Sign in
|
||||
</button>
|
||||
</form>
|
||||
<button class="btn btn-lg btn-primary" type="submit">
|
||||
Sign in
|
||||
</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
</table>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<a class="btn btn-primary" href="{{ path('productcategory_index') }}"> <i class="fa fa-arrow-left"></i>Retour à la liste</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary" href="{{ path('productcategory_edit', { 'id': productCategory.id }) }}">edit</a>
|
||||
</li>
|
||||
{# <li>#}
|
||||
{# <a class="btn btn-primary" href="{{ path('productcategory_index') }}"> <i class="fa fa-arrow-left"></i>Retour à la liste</a>#}
|
||||
{# </li>#}
|
||||
{# <li>#}
|
||||
{# <a class="btn btn-primary" href="{{ path('productcategory_edit', { 'id': productCategory.id }) }}">edit</a>#}
|
||||
{# </li>#}
|
||||
<li>
|
||||
{{ form_start(delete_form) }}
|
||||
<input type="submit" value="Delete">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue