Global CSRF
This commit is contained in:
1 parent
82f8b28353
commit
189432811f
2 files changed
+2
-3
No files matched your search
@@ -9,7 +9,7 @@ class Netig < Roda
|
|||||||
plugin :public
|
plugin :public
|
||||||
plugin :default_headers, "Content-Type" => "text/html; charset=utf-8"
|
plugin :default_headers, "Content-Type" => "text/html; charset=utf-8"
|
||||||
plugin :sessions, secret: ENV.fetch("SESSION_SECRET")
|
plugin :sessions, secret: ENV.fetch("SESSION_SECRET")
|
||||||
plugin :route_csrf
|
plugin :route_csrf, csrf_failure: :empty_403
|
||||||
plugin :hash_branches
|
plugin :hash_branches
|
||||||
plugin :flash
|
plugin :flash
|
||||||
|
|
||||||
@@ -17,6 +17,7 @@ class Netig < Roda
|
|||||||
|
|
||||||
route do |r|
|
route do |r|
|
||||||
r.public
|
r.public
|
||||||
|
check_csrf!
|
||||||
r.hash_branches
|
r.hash_branches
|
||||||
|
|
||||||
r.root do
|
r.root do
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ class Netig
|
|||||||
end
|
end
|
||||||
|
|
||||||
r.post "send" do
|
r.post "send" do
|
||||||
check_csrf!
|
|
||||||
|
|
||||||
form = ContactForm.new(r.params)
|
form = ContactForm.new(r.params)
|
||||||
|
|
||||||
if form.spam?
|
if form.spam?
|
||||||
|
|||||||
Reference in new issue
Block a user