Commit 7204b019 authored by Mat's avatar Mat

comment hériter de FOSUserBundle dans le contexte de MonBundle (Techno)

prendre le code du layout dans le vendor, et l'utiliser dans le contexte
de mon bundle. voir
https://openclassrooms.com/courses/developpez-votre-site-web-avec-le-framework-symfony/securite-et-gestion-des-utilisateurs-1#/id/r-3624754

php bin/console debug:router ->
fos_user_security_login      GET|POST     ANY      ANY    /login

fos_user_security_check      POST         ANY      ANY    /login_check

fos_user_security_logout     GET|POST     ANY      ANY    /logout
parent 6eeedd32
......@@ -16,7 +16,11 @@ security:
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager # Use form.csrf_provider instead for Symfony <2.4
logout: true
login_path: fos_user_security_login
check_path: fos_user_security_check
logout:
path: fos_user_security_logout
target: fos_user_security_login
anonymous: true
access_control:
......
<div id="login">
{% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}
{{ 'layout.logged_in_as'|trans({'%username%': app.user.username}, 'FOSUserBundle') }} |
<a href="{{ path('fos_user_security_logout') }}">
{{ 'layout.logout'|trans({}, 'FOSUserBundle') }}
</a>
{% else %}
<a href="{{ path('fos_user_security_login') }}">
{{ 'layout.login'|trans({}, 'FOSUserBundle') }}
</a> |
<a href="{{ path('fos_user_registration_register') }}">
{{ 'layout.register'|trans({}, 'FOSUserBundle') }}
</a>
{% endif %}
</div>
......@@ -13,6 +13,9 @@
<div class="container">
{% block header %}
{% include '@Techno/Default/login.html.twig' %}
<div class="accueil">
<h1>cassis</h1>
<h3>la dernière chance du moment</h3>
......@@ -102,6 +105,24 @@
<h1>{{ block('title') }}</h1>
{% if app.request.hasPreviousSession %}
{% for type, messages in app.session.flashbag.all() %}
{% for message in messages %}
<div class="flash-{{ type }}">
{{ message }}
</div>
{% endfor %}
{% endfor %}
{% endif %}
<div>
{% block fos_user_content %}
{% endblock fos_user_content %}
</div>
{% endblock %}
</section>
......
......@@ -6,4 +6,8 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
class TechnoBundle extends Bundle
{
public function getParent()
{
return 'FOSUserBundle';
}
}
......@@ -104,7 +104,12 @@ div.container {
#header .container {
padding-bottom: 1px;
min-height: 120px;
position: relative;
}
#header .container #login {
position: absolute;
top: 1em;
right: 3em;
}
#hero .container {
padding: 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment