Commit 3935d7db authored by Serge S. Koval's avatar Serge S. Koval

Fixed #858 - Automtically inject flask-wtf CSRF token even if form is not derived from flask-wtf

parent a51713a0
...@@ -110,7 +110,11 @@ ...@@ -110,7 +110,11 @@
<form class="icon" method="POST" action="{{ get_url('.delete_view') }}"> <form class="icon" method="POST" action="{{ get_url('.delete_view') }}">
{{ delete_form.id(value=get_pk_value(row)) }} {{ delete_form.id(value=get_pk_value(row)) }}
{{ delete_form.url(value=return_url) }} {{ delete_form.url(value=return_url) }}
{% if delete_form.csrf_token %}
{{ delete_form.csrf_token }} {{ delete_form.csrf_token }}
{% elif csrf_token %}
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
{% endif %}
<button onclick="return confirm('{{ _gettext('Are you sure you want to delete this record?') }}');" title="{{ _gettext('Delete record') }}"> <button onclick="return confirm('{{ _gettext('Are you sure you want to delete this record?') }}');" title="{{ _gettext('Delete record') }}">
<i class="fa fa-trash icon-trash"></i> <i class="fa fa-trash icon-trash"></i>
</button> </button>
......
...@@ -110,7 +110,11 @@ ...@@ -110,7 +110,11 @@
<form class="icon" method="POST" action="{{ get_url('.delete_view') }}"> <form class="icon" method="POST" action="{{ get_url('.delete_view') }}">
{{ delete_form.id(value=get_pk_value(row)) }} {{ delete_form.id(value=get_pk_value(row)) }}
{{ delete_form.url(value=return_url) }} {{ delete_form.url(value=return_url) }}
{% if delete_form.csrf_token %}
{{ delete_form.csrf_token }} {{ delete_form.csrf_token }}
{% elif csrf_token %}
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
{% endif %}
<button onclick="return confirm('{{ _gettext('Are you sure you want to delete this record?') }}');" title="Delete record"> <button onclick="return confirm('{{ _gettext('Are you sure you want to delete this record?') }}');" title="Delete record">
<span class="fa fa-trash glyphicon glyphicon-trash"></span> <span class="fa fa-trash glyphicon glyphicon-trash"></span>
</button> </button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment