Fix csrf token for forms
This commit is contained in:
parent
0c189610ca
commit
ec1665bdcf
1 changed files with 4 additions and 4 deletions
|
@ -503,7 +503,7 @@ See also: extract-question-components, split-list-by-keyword, resolve-input-and-
|
||||||
`(progn ,@(loop for value in values
|
`(progn ,@(loop for value in values
|
||||||
collect `(:li (apply-input-form ,type ,group ,value))))))))))))
|
collect `(:li (apply-input-form ,type ,group ,value))))))))))))
|
||||||
|
|
||||||
(defmacro with-form ((&key action intro) &body body)
|
(defmacro with-form ((&key csrf-token action intro) &body body)
|
||||||
"Create a standardized HTML form wrapped in a <div> tag with a pre-defined
|
"Create a standardized HTML form wrapped in a <div> tag with a pre-defined
|
||||||
class and structure, using the Spinneret library.
|
class and structure, using the Spinneret library.
|
||||||
|
|
||||||
|
@ -512,12 +512,12 @@ ACTION: Form action.
|
||||||
INTRO: Write some information related to the form. Could be a introduction."
|
INTRO: Write some information related to the form. Could be a introduction."
|
||||||
`(spinneret:with-html
|
`(spinneret:with-html
|
||||||
(:div
|
(:div
|
||||||
(when ,intro (:p :class "alert alert-light" ,intro))
|
,@(when intro `((:p :class "alert alert-light" ,intro)))
|
||||||
(:form :action (unless ,action "/")
|
(:form :action (unless ,action "/")
|
||||||
:method "post"
|
:method "post"
|
||||||
:class (spacing :property "m" :side "y" :size 1)
|
:class (spacing :property "m" :side "y" :size 1)
|
||||||
(when csrf-token
|
,@(when csrf-token
|
||||||
(:input :type "hidden" :name "csrf-token" :value csrf-token))
|
`((:input :type "hidden" :name "csrf-token" :value ,csrf-token)))
|
||||||
,@body
|
,@body
|
||||||
(btn-primary (:type "submit")
|
(btn-primary (:type "submit")
|
||||||
(t9n "submit"))))))
|
(t9n "submit"))))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue