<commit_before># coding: UTF-8

require 'oauth/controllers/provider_controller'

class OauthController < ApplicationController

  include OAuth::Controllers::ProviderController

  def authorize
    if params[:oauth_token]
      unless @token = ::RequestToken.find_by_token(params[:oauth_token])
        render :action => "authorize_failure" and return
      end
      unless @token.invalidated?
        @token.authorize!(current_user)
        @redirect_url = URI.parse(@token.oob? ? @token.client_application.callback_url : @token.callback_url)

        unless @redirect_url.to_s.blank?
          @redirect_url.query = @redirect_url.query.blank? ?
                                "oauth_token=#{@token.token}&oauth_verifier=#{@token.verifier}" :
                                @redirect_url.query + "&oauth_token=#{@token.token}&oauth_verifier=#{@token.verifier}"
          redirect_to @redirect_url.to_s<commit_msg>Fixed authentication issue for Desktop applications<commit_after># coding: UTF-8

require 'oauth/controllers/provider_controller'

class OauthController < ApplicationController

  include OAuth::Controllers::ProviderController

  skip_before_filter :login_required, :only => :authorize

  def authorize
    if params[:oauth_token]
      unless @token = ::RequestToken.find_by_token(params[:oauth_token])
        render :action => "authorize_failure" and return
      end
      unless @token.invalidated?
        if logged_in?
          @token.authorize!(current_user)
        else
          @token.authorize!(@token.client_application.user)
        end
        @redirect_url = URI.parse(@token.oob? ? @token.client_application.callback_url || "http://cartodb.com" : @token.callback_url)

        unless @redirect_url.to_s.blank?
          @redirect_url.query = @redirect_url.query.blank? ?
                                "oauth_token=#{@token.token}&oauth_verifier=#{@token.verifier}" :
                                @redirect_url.query + "&oauth_token=#{@token.token}&oauth_verifier=#{@token.verifier}"
          redirect_to @redirect_url.to_s
{'fraction_non_alphanumeric': 0.11288759689922481, 'fraction_numerical': 0.0009689922480620155, 'mean_word_length': 3.1549295774647885, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5306183', 'n_tokens_mistral': 618, 'n_tokens_neox': 602, 'n_words': 92}