X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/dae3dcf87edcfc0648cd0b93b069b0eee67d3ab7..36a382bb43c81847b9463066a57cc7986d7cd731:/app/controllers/oauth_controller.rb diff --git a/app/controllers/oauth_controller.rb b/app/controllers/oauth_controller.rb index 59ebfd631..84bbcf185 100644 --- a/app/controllers/oauth_controller.rb +++ b/app/controllers/oauth_controller.rb @@ -27,7 +27,7 @@ class OauthController < ApplicationController end def revoke - @token = current_user.oauth_tokens.find_by_token params[:token] + @token = current_user.oauth_tokens.find_by :token => params[:token] if @token @token.invalidate! flash[:notice] = t("oauth.revoke.flash", :application => @token.client_application.name) @@ -38,6 +38,8 @@ class OauthController < ApplicationController protected def oauth1_authorize + append_content_security_policy_directives(:form_action => %w[*]) + if @token.invalidated? @message = t "oauth.oauthorize_failure.invalid" render :action => "authorize_failure" @@ -49,7 +51,7 @@ class OauthController < ApplicationController else @token.oob? ? @token.client_application.callback_url : @token.callback_url end - @redirect_url = URI.parse(callback_url) unless callback_url.blank? + @redirect_url = URI.parse(callback_url) if callback_url.present? if @redirect_url.to_s.blank? render :action => "authorize_success" @@ -61,9 +63,7 @@ class OauthController < ApplicationController "&oauth_token=#{@token.token}" end - unless @token.oauth10? - @redirect_url.query += "&oauth_verifier=#{@token.verifier}" - end + @redirect_url.query += "&oauth_verifier=#{@token.verifier}" unless @token.oauth10? redirect_to @redirect_url.to_s end