Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rails 5] Update Angular CSRF handling #6685

Merged
merged 1 commit into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ gem 'mini_racer', '0.2.15'

gem 'uglifier', '>= 1.0.3'

gem 'angular_rails_csrf'
gem 'foundation-icons-sass-rails'

gem 'foundation-rails', '= 5.5.2.1'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ GEM
railties (>= 3.1)
sprockets (~> 2.0)
tilt
angular_rails_csrf (4.2.0)
railties (>= 3, < 7)
angularjs-file-upload-rails (2.4.1)
angularjs-rails (1.5.5)
arel (6.0.4)
Expand Down Expand Up @@ -732,6 +734,7 @@ DEPENDENCIES
acts_as_list (= 0.9.19)
andand
angular-rails-templates (~> 0.3.0)
angular_rails_csrf
angularjs-file-upload-rails (~> 2.4.1)
angularjs-rails (= 1.5.5)
atomic
Expand Down
3 changes: 3 additions & 0 deletions Gemfile_next.lock
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ GEM
railties (>= 4.2, < 7)
sprockets (>= 3.0, < 5)
tilt
angular_rails_csrf (4.2.0)
railties (>= 3, < 7)
angularjs-file-upload-rails (2.4.1)
angularjs-rails (1.5.5)
arel (7.1.4)
Expand Down Expand Up @@ -556,6 +558,7 @@ DEPENDENCIES
acts_as_list (= 0.9.19)
andand
angular-rails-templates (>= 0.3.0)
angular_rails_csrf
angularjs-file-upload-rails (~> 2.4.1)
angularjs-rails (= 1.5.5)
atomic
Expand Down
1 change: 0 additions & 1 deletion app/assets/javascripts/admin/admin_ofn.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ angular.module("ofn.admin", [
"admin.taxons",
"infinite-scroll"
]).config ($httpProvider) ->
$httpProvider.defaults.headers.common["X-CSRF-Token"] = $("meta[name=csrf-token]").attr("content")
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
angular.module("admin.indexUtils", ['admin.resources', 'ngSanitize', 'templates', 'admin.utils']).config ($httpProvider) ->
$httpProvider.defaults.headers.common["X-CSRF-Token"] = $("meta[name=csrf-token]").attr("content"); $httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*";
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
angular.module('admin.orderCycles', ['ngTagsInput', 'admin.indexUtils', 'admin.enterprises'])

.config ($httpProvider) ->
$httpProvider.defaults.headers.common['X-CSRF-Token'] = $('meta[name=csrf-token]').attr('content')

.directive 'datetimepicker', ($timeout, $parse) ->
require: "ngModel"
link: (scope, element, attrs, ngModel) ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
angular.module("admin.productImport", ["ngResource"]).config ($httpProvider) ->
$httpProvider.defaults.headers.common["X-CSRF-Token"] = $("meta[name=csrf-token]").attr("content")
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"
3 changes: 2 additions & 1 deletion app/assets/javascripts/admin/utils/utils.js.coffee
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
angular.module("admin.utils", ["templates", "ngSanitize"]).config ($httpProvider) -> $httpProvider.defaults.headers.common["X-CSRF-Token"] = $("meta[name=csrf-token]").attr("content"); $httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*";
angular.module("admin.utils", ["templates", "ngSanitize"]).config ($httpProvider) ->
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"
1 change: 0 additions & 1 deletion app/assets/javascripts/darkswarm/darkswarm.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ window.Darkswarm = angular.module("Darkswarm", [
'angularFileUpload',
'angularSlideables'
]).config ($httpProvider, $tooltipProvider, $locationProvider, $anchorScrollProvider) ->
$httpProvider.defaults.headers['common']['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
$httpProvider.defaults.headers['common']['X-Requested-With'] = 'XMLHttpRequest'
$httpProvider.defaults.headers.common.Accept = "application/json, text/javascript, */*"

Expand Down