瀏覽代碼

Reacue from csrf with message

Maarten van den Berg 8 年之前
父節點
當前提交
c9bf6acdf7
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      app/controllers/application_controller.rb

+ 6 - 0
app/controllers/application_controller.rb

@@ -1,3 +1,9 @@
1 1
 class ApplicationController < ActionController::Base
2 2
   protect_from_forgery with: :exception
3
+  rescue_from ActionController::InvalidAuthenticityToken, with: :invalid_auth_token
4
+
5
+  private
6
+  def invalid_auth_token
7
+    render text: "You submitted an invalid request! If you got here after clicking a link, it's possible that someone is doing something nasty!", status: 400
8
+  end
3 9
 end