]> git.openstreetmap.org Git - rails.git/commitdiff
Remove form_action restrictions for ouath2_authorizations#create
authorTom Hughes <tom@compton.nu>
Mon, 17 Jan 2022 09:33:28 +0000 (09:33 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 17 Jan 2022 09:33:28 +0000 (09:33 +0000)
Fixes #3424

.rubocop_todo.yml
app/controllers/oauth2_authorizations_controller.rb

index b60dd53329374286fc6d582ba3eac2c47df9b4b6..8c0827ab7d357f1bc2548d8200f27b2cc47a741a 100644 (file)
@@ -161,6 +161,7 @@ Rails/HelperInstanceVariable:
 Rails/LexicallyScopedActionFilter:
   Exclude:
     - 'app/controllers/oauth2_applications_controller.rb'
+    - 'app/controllers/oauth2_authorizations_controller.rb'
 
 # Offense count: 5
 # Configuration parameters: Include.
index b851d19b2dd1cd6aea8661bdd8f44d2edd86f8a7..54a63fc84c53aeac4e4edb891bf187c512bfdc6a 100644 (file)
@@ -3,12 +3,13 @@ class Oauth2AuthorizationsController < Doorkeeper::AuthorizationsController
 
   prepend_before_action :authorize_web
   before_action :set_locale
+  before_action :allow_all_form_action, :only => [:new, :create]
 
   authorize_resource :class => false
 
-  def new
-    override_content_security_policy_directives(:form_action => []) if Settings.csp_enforce || Settings.key?(:csp_report_url)
+  private
 
-    super
+  def allow_all_form_action
+    override_content_security_policy_directives(:form_action => []) if Settings.csp_enforce || Settings.key?(:csp_report_url)
   end
 end