Created
April 20, 2009 18:51
-
-
Save gbuesing/98660 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionController::Base.class_eval do | |
protected | |
# BACKPORT OF CHANGE FROM 3.0 EDGE: http://github.com/rails/rails/commit/256b0ee8e3c1610967dfc89f864e24b98ed3c236 | |
# Returns true or false if a request is verified. Checks: | |
# | |
# * is the format restricted? By default, only HTML requests are checked. | |
# * is it a GET request? Gets should be safe and idempotent | |
# * Does the form_authenticity_token match the given token value from the params? | |
def self.verified_request? | |
!protect_against_forgery? || | |
request.method == :get || | |
request.xhr? || | |
!verifiable_request_format? || | |
form_authenticity_token == params[request_forgery_protection_token] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment