Created
January 13, 2014 15:10
-
-
Save kirel/8401981 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
| module AngularCsrf | |
| def self.included(klass) | |
| klass.after_filter :set_csrf_cookie_for_ng | |
| end | |
| protected | |
| def set_csrf_cookie_for_ng | |
| cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery? | |
| end | |
| def verified_request? | |
| super || form_authenticity_token == request.headers['X-XSRF-TOKEN'] | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment