Index: openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl,v diff -u -r1.36.2.29 -r1.36.2.30 --- openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl 27 Nov 2016 12:19:35 -0000 1.36.2.29 +++ openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl 5 Feb 2017 11:37:33 -0000 1.36.2.30 @@ -2247,6 +2247,32 @@ ] $complaint_template] } +namespace eval ::template::csrf { + ad_proc ::template::csrf::validate { + -package_id + } { + validate a csrf token + + @author Gustaf Neumann + @creation-date Feb 2, 2017 + } { + if {![info exists package_id]} { + if {![ns_conn isconnected]} { + return 0 + } + set package_id [ad_conn package_id] + } + set validateCSRF_p [parameter::get \ + -package_id $package_id \ + -parameter "ValidateCSRFP" \ + -default 1] + + if {$validateCSRF_p ne "" && $validateCSRF_p} { + security::csrf::validate + } + } +} + # Local variables: # mode: tcl # tcl-indent-level: 4