SF2,登录表单出现两次


SF2, login form appears twice

我使用fos_user_bundle来管理我的用户。当我进入mysite/login时,登录表单出现了两次

我重写了login.html.twig模板。

我改变UserBundle:

class UserBundle extends Bundle
{
  public function getParent()
  {
    return 'FOSUserBundle';
  }
}

:资源/视图/安全/login.html。树枝

{% trans_default_domain 'FOSUserBundle' %}
{% extends '::layout.html.twig' %}
{% block content %}
  {% block fos_user_content %}
    {% if error %}
        <div>{{ error|trans }}</div>
    {% endif %}
    <form action="{{ path("fos_user_security_check") }}" method="post">
        <input type="hidden" name="_csrf_token" value="{{ csrf_token }}" />
        <label for="username">{{ 'security.login.username'|trans }}</label>
        <input type="text" id="username" name="_username" value="{{ last_username }}" required="required" />
        <label for="password">{{ 'security.login.password'|trans }}</label>
        <input type="password" id="password" name="_password" required="required" />
        <input type="checkbox" id="remember_me" name="_remember_me" value="on" />
        <label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>
        <input type="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans }}" />
    </form>
  {% endblock fos_user_content %}
{% endblock content %}

在my layout.html.twig中我给出了:

{% block container %}
  {{ parent() }}  
  {% block content %}
  {% endblock content %}
{% endblock container %}

我删除了{{parent()}},现在,它工作了。