|
@@ -2,4 +2,15 @@ class ApplicationController < ActionController::Base
|
2
|
2
|
# Prevent CSRF attacks by raising an exception.
|
3
|
3
|
# For APIs, you may want to use :null_session instead.
|
4
|
4
|
protect_from_forgery with: :exception
|
|
5
|
+
|
|
6
|
+ after_filter :set_csrf_cookie_for_ng
|
|
7
|
+ def set_csrf_cookie_for_ng
|
|
8
|
+ cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?
|
|
9
|
+ end
|
|
10
|
+
|
|
11
|
+ protected
|
|
12
|
+
|
|
13
|
+ def verified_request?
|
|
14
|
+ super || form_authenticity_token == request.headers['X-XSRF-TOKEN']
|
|
15
|
+ end
|
5
|
16
|
end
|