about summary refs log tree commit diff
path: root/app/controllers/api/web/base_controller.rb
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-04-18 18:48:12 -0500
committerDavid Yip <yipdw@member.fsf.org>2018-04-18 18:48:12 -0500
commit16d5217502a09132dc14a3a808036af5dbcb73dd (patch)
treedeb7b81919e5f8082b7d848b0b8df4787d37f001 /app/controllers/api/web/base_controller.rb
parent813da6788e5129579db04e89aac3076902af2c7a (diff)
parentff87d1bc3ecdb81ff5c523f0964ecf223a503d30 (diff)
Merge remote-tracking branch 'origin/master' into gs-master
  Conflicts:
 	app/controllers/home_controller.rb
 	app/controllers/stream_entries_controller.rb
 	app/javascript/mastodon/locales/ja.json
 	app/javascript/mastodon/locales/pl.json
Diffstat (limited to 'app/controllers/api/web/base_controller.rb')
-rw-r--r--app/controllers/api/web/base_controller.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/api/web/base_controller.rb b/app/controllers/api/web/base_controller.rb
new file mode 100644
index 000000000..8da549b3a
--- /dev/null
+++ b/app/controllers/api/web/base_controller.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class Api::Web::BaseController < Api::BaseController
+  protect_from_forgery with: :exception
+
+  rescue_from ActionController::InvalidAuthenticityToken do
+    render json: { error: "Can't verify CSRF token authenticity." }, status: 422
+  end
+end