浏览代码

Suppress CSRF token warnings (#6240)

CSRF token checking was enabled for API controllers in #6223,
producing "Can't verify CSRF token authenticity" log spam. This
disables logging of failed CSRF checks.

This also changes the protection strategy for
PushSubscriptionsController to use exceptions, making it consistent
with other controllers that use sessions.
master
Patrick Figel 6 年前
committed by Eugen Rochko
父节点
当前提交
537d2939b1
共有 2 个文件被更改,包括 4 次插入0 次删除
  1. +1
    -0
      app/controllers/api/web/push_subscriptions_controller.rb
  2. +3
    -0
      config/initializers/suppress_csrf_warnings.rb

+ 1
- 0
app/controllers/api/web/push_subscriptions_controller.rb 查看文件

@@ -4,6 +4,7 @@ class Api::Web::PushSubscriptionsController < Api::BaseController
respond_to :json

before_action :require_user!
protect_from_forgery with: :exception

def create
params.require(:subscription).require(:endpoint)


+ 3
- 0
config/initializers/suppress_csrf_warnings.rb 查看文件

@@ -0,0 +1,3 @@
# frozen_string_literal: true

ActionController::Base.log_warning_on_csrf_failure = false

正在加载...
取消
保存