Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #138 from fsateler/master

Create a new helper csrf_tag to create the hidden input tag
  • Loading branch information...
commit 5abcbae0ff8e49682a97c65191350eedb8d6d0ba 2 parents af4ae32 + 0960594
Anatoliy Chakkaev authored March 21, 2012

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. 6  lib/helpers.js
6  lib/helpers.js
@@ -209,7 +209,7 @@ HelperSet.prototype.form_tag = function (params, block) {
209 209
 
210 210
     // push output
211 211
     buf.push('<form' + htmlTagParams(params) + '>');
212  
-    buf.push('<input type="hidden" name="' + this.controller.request.csrfParam + '" value="' + this.controller.request.csrfToken + '" />');
  212
+    buf.push( this.csrf_tag() );
213 213
 
214 214
     // alternative method?
215 215
     if (_method !== params.method) {
@@ -290,6 +290,10 @@ HelperSet.prototype.label_tag = function (text, params, override) {
290 290
     return genericTag('label', text, params, override);
291 291
 };
292 292
 
  293
+HelperSet.prototype.csrf_tag = function() {
  294
+    return '<input type="hidden" name="' + this.controller.request.csrfParam + '" value="' + this.controller.request.csrfToken + '" />';
  295
+}
  296
+
293 297
 HelperSet.prototype.sanitize = sanitizeHTML;
294 298
 
295 299
 /**

0 notes on commit 5abcbae

Please sign in to comment.
Something went wrong with that request. Please try again.