Bonjour,

je souhaite surcharger mes vues et avoir les deux formulaires inscription et connection, j'ai donc commencé par créer la vue login_content.html.twig mais quand j'essaie de m'inscrire j'ai l'erreur comme quoi le jeton csrf est invalide.

Voici le code de ma vue:

{% trans_default_domain 'FOSUserBundle' %}
<br /><br />
<div class="container">
    <div class="container-fluid">
<div class="col-md-4">
{% if error %}
    <div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}

<form action="{{ path("fos_user_security_check") }}" method="post">
    {% if csrf_token %}
        <input type="hidden" name="_csrf_token" value="{{ csrf_token }}" />
    {% endif %}

    <label for="username">{{ 'security.login.username'|trans }}</label>
    <input class="form-control" type="text" id="username" name="_username" value="{{ last_username }}" required="required" autocomplete="username" />

    <label for="password">{{ 'security.login.password'|trans }}</label>
    <input class="form-control" type="password" id="password" name="_password" required="required" autocomplete="current-password" />

    <input type="checkbox" id="remember_me" name="_remember_me" value="on" />
    <label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>

    <input class="btn btn-primary pulse" type="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans }}" />
</form>
</div>

        <div class="col-md-offset-2 col-md-6">
            <div>

                <form name="fos_user_registration_form" method="post" action="/app_dev.php/register/" class="fos_user_registration_register">
                    <div id="fos_user_registration_form">
                        <div>
                            <label for="fos_user_registration_form_email" class="required">Adresse e-mail</label>
                            <input class="form-control" type="email" id="fos_user_registration_form_email" name="fos_user_registration_form[email]" required="required" />
                        </div>
                        <div>
                            <label for="fos_user_registration_form_username" class="required">Nom d&#039;utilisateur</label>
                            <input class="form-control" type="text" id="fos_user_registration_form_username" name="fos_user_registration_form[username]" required="required" maxlength="180" pattern=".{2,}" />
                        </div>
                        <div>
                            <label for="fos_user_registration_form_plainPassword_first" class="required">Mot de passe</label>
                            <input class="form-control" type="password" id="fos_user_registration_form_plainPassword_first" name="fos_user_registration_form[plainPassword][first]" required="required" autocomplete="new-password" />
                        </div>
                        <div>
                            <label for="fos_user_registration_form_plainPassword_second" class="required">Répéter le mot de passe</label>
                            <input class="form-control" type="password" id="fos_user_registration_form_plainPassword_second" name="fos_user_registration_form[plainPassword][second]" required="required" autocomplete="new-password" />
                        </div>
                        <input type="hidden" id="fos_user_registration_form__token" name="fos_user_registration_form[_token]" value="{{ csrf_token }}" />
                    </div>
                    <div>
                        <input class="btn btn-primary pulse" type="submit" value="Créer un compte" />
                    </div>
                </form>
            </div>
        </div>

    </div></div><br /><br />

Aucune réponse