Module: Padrino::Helpers::FormHelpers::Security

Overview

Helpers to generate form security tags for csrf protection.

Instance Method Summary

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.

Examples:

csrf_meta_tags

Returns:

  • (String) — The meta tags with the CSRF token and the param your app expects it in.

#csrf_token_field ⇒ String

Constructs a hidden field containing a CSRF token.

Examples:

csrf_token_field

Parameters:

  • token (String) — The token to use. Will be read from the session by default.

Returns:

  • (String) — The hidden field with CSRF token as value.