Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If the CSRF is disabled, also remove the metatags. #802

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/browser_app_skeleton/src/components/shared/layout_head.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,27 @@ class Shared::LayoutHead < BaseComponent
title "My App - #{@page_title}"
css_link asset("css/app.css")
js_link asset("js/app.js"), defer: "true"
csrf_meta_tags
csrf_meta_tags if include_csrf_tag?
responsive_meta_tag

# Development helper used with the `lucky watch` command.
# Reloads the browser when files are updated.
live_reload_connect_tag if LuckyEnv.development?
end
end

# Cross Site Request Forgery protection is
# enabled by default. This includes a hidden input
# used in forms when using the `form_for` method.
#
# This can be disabled by creating a new `config/forms.cr`
# file, and setting this to `false`.
# ```
# Lucky::FormHelpers.configure do |settings|
# settings.include_csrf_tag = false
# end
# ```
private def include_csrf_tag? : Bool
Lucky::FormHelpers.settings.include_csrf_tag
end
end