Skip to content

Commit

Permalink
Merge pull request #16 from admin-platform/do-not-render-csrf-token-t…
Browse files Browse the repository at this point in the history
…wice

Do not render CSRF token twice.
  • Loading branch information
andriusvo authored May 3, 2022
2 parents 9c7fc8d + 865fd1a commit f957a66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Resources/views/Crud/Create/_content.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
{{ form_start(form, {'action': path(configuration.vars.route.name|default(configuration.getRouteName('create')), configuration.vars.route.parameters|default({})), 'attr': {'class': 'ui loadable form', 'novalidate': 'novalidate'}}) }}
{% if configuration.vars.templates.form is defined %}
{% include configuration.vars.templates.form %}
{% if not form._token.isRendered %}
{{ form_row(form._token) }}
{% endif %}
{% else %}
{{ form_widget(form) }}
{% endif %}

{% include '@SyliusUi/Form/Buttons/_create.html.twig' with {'paths': {'cancel': path(configuration.getRouteName('index'), configuration.vars.route.parameters|default({}))}} %}

{{ form_row(form._token) }}
{{ form_end(form, {'render_rest': false}) }}
</div>
5 changes: 4 additions & 1 deletion src/Resources/views/Crud/Update/_content.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
<input type="hidden" name="_method" value="PUT" />
{% if configuration.vars.templates.form is defined %}
{% include configuration.vars.templates.form %}
{% if not form._token.isRendered %}
{{ form_row(form._token) }}
{% endif %}
{% else %}
{{ form_widget(form) }}
{% endif %}
{% include '@SyliusUi/Form/Buttons/_update.html.twig' with {'paths': {'cancel': path(configuration.getRouteName('index'), configuration.vars.route.parameters|default({}))}} %}
{{ form_row(form._token) }}

{{ form_end(form, {'render_rest': false}) }}
</div>

0 comments on commit f957a66

Please sign in to comment.