Module: Padrino::Helpers::FormHelpers::Security
- Defined in:
- padrino-helpers/lib/padrino-helpers/form_helpers/security.rb
Overview
Helpers to generate form security tags for csrf protection.
Instance Method Summary collapse
-
#csrf_meta_tags ⇒ String
Constructs meta tags ‘csrf-param` and `csrf-token` with the name of the cross-site request forgery protection parameter and token, respectively.
-
#csrf_token_field ⇒ String
Constructs a hidden field containing a CSRF token.
Instance Method Details
#csrf_meta_tags ⇒ String
Constructs meta tags ‘csrf-param` and `csrf-token` with the name of the cross-site request forgery protection parameter and token, respectively.
34 35 36 37 38 39 |
# File 'padrino-helpers/lib/padrino-helpers/form_helpers/security.rb', line 34 def if is_protected_from_csrf? (csrf_param, :name => 'csrf-param') << (csrf_token, :name => 'csrf-token') end end |
#csrf_token_field ⇒ String
Constructs a hidden field containing a CSRF token.
21 22 23 |
# File 'padrino-helpers/lib/padrino-helpers/form_helpers/security.rb', line 21 def csrf_token_field hidden_field_tag csrf_param, :value => csrf_token end |