diff default/input/form.html @ 37:eb9a42fca6c8

input/form: added csrf_token hidden field if it is defined, and import form with context to get this variable
author Goffi <goffi@goffi.org>
date Mon, 10 Jul 2017 19:11:34 +0200
parents 8b5615a1bf3d
children 87680eed9e25
line wrap: on
line diff
--- a/default/input/form.html	Tue Jul 04 07:54:32 2017 +0200
+++ b/default/input/form.html	Mon Jul 10 19:11:34 2017 +0200
@@ -1,5 +1,8 @@
 {% macro form(action='') %}
 <form method="post" action="{{action}}">
+    {% if csrf_token is defined %}
+        <input type="hidden" name="csrf_token" value="{{csrf_token}}">
+    {% endif %}
     {{ caller() }}
 </form>
 {% endmacro %}