<commit_before>class OauthController < ApplicationController

  before_filter do
    if check_params
      warden.authenticate! scope: :user
    else
      render :bad_request if @errors.present?
    end
  end

  def index
    if request.get?
      if @app_id.account == Account.current || @app_id.registered?
        @token = CenitToken.create(data: { scope: @scope.to_s, redirect_uri: @redirect_uri, state: params[:state] }).token
      else
        @errors << 'Unregistered app'
      end
    else
      if (token = CenitToken.where(token: @token).first) &&
        token.data.is_a?(Hash) &&
        (redirect_uri = token.data['redirect_uri']) &&
        (scope = token.data['scope'])
        token.destroy
        if @consent_action == :allow
          code_token = OauthCodeToken.create(scope: scope)
          redirect_uri += "?code=#{URI.encode(code_token.token)}"<commit_msg>Prevent no APP ID found<commit_after>class OauthController < ApplicationController

  before_filter do
    if check_params
      warden.authenticate! scope: :user
    else
      render :bad_request if @errors.present?
    end
  end

  def index
    if request.get?
      if @app_id && @app_id.account == Account.current || @app_id.registered?
        @token = CenitToken.create(data: { scope: @scope.to_s, redirect_uri: @redirect_uri, state: params[:state] }).token
      else
        @errors << 'Unregistered app'
      end
    else
      if (token = CenitToken.where(token: @token).first) &&
        token.data.is_a?(Hash) &&
        (redirect_uri = token.data['redirect_uri']) &&
        (scope = token.data['scope'])
        token.destroy
        if @consent_action == :allow
          code_token = OauthCodeToken.create(scope: scope)
          redirect_uri += "?code=#{URI.encode(code_token.token)}"
{'fraction_non_alphanumeric': 0.1225517627308338, 'fraction_numerical': 0.0, 'mean_word_length': 2.8123667377398722, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '7538973', 'n_tokens_mistral': 560, 'n_tokens_neox': 550, 'n_words': 120}