我正在尝试覆盖我的 html 树枝视图,希望它能解决验证消息的问题。
html 树枝文件:
{% extends "FOSUserBundle::layout.html.twig" %}
{% block fos_user_content %}
<form action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST" class="fos_user_registration_register">
<div>
<label for="fos_user_registration_form_username" class="required">Nom d'utilisateur :</label>
<input type="text" id="fos_user_registration_form_username" name="fos_user_registration_form[username]" required="required" maxlength="255" pattern=".{2,}" />
</div>
<div>
<label for="fos_user_registration_form_email" class="required">Adresse e-mail :</label>
<input type="email" id="fos_user_registration_form_email" name="fos_user_registration_form[email]" required="required" /></div>
<div>
<label for="fos_user_registration_form_plainPassword_first" class="required">Mot de passe :</label>
<input type="password" id="fos_user_registration_form_plainPassword_first" name="fos_user_registration_form[plainPassword][first]" required="required" /></div>
<div>
<label for="fos_user_registration_form_plainPassword_second" class="required">Vérification :</label>
<input type="password" id="fos_user_registration_form_plainPassword_second" name="fos_user_registration_form[plainPassword][second]" required="required" /></div>
<div>
<input type="submit" value="{{ 'registration.submit'|trans({}, 'FOSUserBundle') }}" />
</div>
</form>
{% endblock fos_user_content %}
表单显示正确但未提交。
根据 FOSUser 捆绑实体,输入名称是否正确?缺少什么,出了什么问题?如何显示错误?如何处理 CSRF 隐藏域?