我正在安装FOSUserBundle
我从 Knpbundle 下载的。
我已经按照给出的说明正确配置了它。
我已经创建了一条路线,所以我的路线'app/config/routing.yml'
如下。
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
acme_user:
resource: "@AcmeUserBundle/Resources/config/routing.yml"
prefix: /
我的 routing.yml 文件如下所示。
AcmeUser_Bundle:
pattern: /admin
defaults: { _controller: AcmeUserBundle:User:index}
只要我传入/admin
我的 url,它就会调用我创建的索引文件视图index
。文件看起来像这样。
<body>
<section id="login_form">
<div class="login_form_head">Administration</div>
<form id="admin_login_form" class="formee" method="post" action="{{
path('fos_user_security_check') }}" enctype="multipart/form-data">
<div class="login_form_display">
<div class="login_row"><input type="text" name="_username"
class="validate[required,custom[username]]" id="username"
placeholder="Username" /></div>
<div class="clear"></div>
<div class="login_row"><input type="password" class="validate[required,custom[passwordLogin]]"
name="_password" id="password" placeholder="Password" /></div>
<div class="clear"></div>
</div>
<!--Form footer begin -->
<section class="login_footer">
<div class="textcenter"><input type="submit" value="Login" /></div>
<div class="clear"></div>
</section>
<!--Form footer end -->
</form>
</section><!-- End of #container -->
<div>
{% 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') }}">{{ 'login'|trans({}, 'FOSUserBundle') }}</a>
{% endif %}
</div>
{% for type, messages in app.session.flashbag.all() %}
{% for key, message in messages %}
<div class="flash-{{ type }}">
{{ message|trans({}, 'FOSUserBundle') }}
</div>
{% endfor %}
{% endfor %}
<div>
{% block fos_user_content %}
{% endblock fos_user_content %}
</div>
</body>
它显示了 csrfToken
错误。所以请任何人帮助我理解。