<commit_before># coding: utf-8

class Admin::ClientApplicationsController < ApplicationController
  ssl_required :oauth, :api_key, :regenerate_api_key

  before_filter :login_required

  def oauth
    new_dashboard = current_user.has_feature_flag?('new_dashboard')
    view =  new_dashboard ? 'new_oauth' : 'api_key'
    layout = new_dashboard ? 'new_application' : 'application'

    respond_to do |format|
      format.html { render view, layout: layout }
    end
  end

  def api_key
    new_dashboard = current_user.has_feature_flag?('new_dashboard')
    view =  new_dashboard ? 'new_api_key' : 'api_key'
    layout = new_dashboard ? 'new_application' : 'application'

    respond_to do |format|
      format.html { render view, layout: layout }
    end
  end

  def regenerate_api_key
    begin
      current_user.invalidate_varnish_cache
      current_user.update api_key: User.make_token
      flash_message = "Your API key has been successfully generated"
    rescue Errno::ECONNREFUSED => e
      CartoDB::Logger.info "Could not clear varnish cache", "#{e.inspect}"
      if Rails.env.development?
        current_user.set_map_key
        flash_message = "Your API key has been regenerated succesfully but the varnish cache has not been invalidated."
      else
        raise e
      end
    rescue => e
      raise e
    end 
    redirect_to api_key_credentials_path(user_domain: params[:user_domain], type: 'api_key'), :flash => {:success => "Your API key has been regenerated successfully"}
  end

  def regenerate_oauth
    @client_application = current_user.client_application
    return if request.get?
    current_user.reset_client_application!
    redirect_to api_key_credentials_path(user_domain: params[:user_domain], type: 'oauth'), :flash => {:success => "Your OAuth credentials have been updated successfully"}
  end

end<commit_msg>changed redirect when regenerates oauth keys in new dashboard<commit_after># coding: utf-8

class Admin::ClientApplicationsController < ApplicationController
  ssl_required :oauth, :api_key, :regenerate_api_key

  before_filter :login_required

  def oauth
    new_dashboard = current_user.has_feature_flag?('new_dashboard')
    view =  new_dashboard ? 'new_oauth' : 'api_key'
    layout = new_dashboard ? 'new_application' : 'application'

    respond_to do |format|
      format.html { render view, layout: layout }
    end
  end

  def api_key
    new_dashboard = current_user.has_feature_flag?('new_dashboard')
    view =  new_dashboard ? 'new_api_key' : 'api_key'
    layout = new_dashboard ? 'new_application' : 'application'

    respond_to do |format|
      format.html { render view, layout: layout }
    end
  end

  def regenerate_api_key
    begin
      current_user.invalidate_varnish_cache
      current_user.update api_key: User.make_token
      flash_message = "Your API key has been successfully generated"
    rescue Errno::ECONNREFUSED => e
      CartoDB::Logger.info "Could not clear varnish cache", "#{e.inspect}"
      if Rails.env.development?
        current_user.set_map_key
        flash_message = "Your API key has been regenerated succesfully but the varnish cache has not been invalidated."
      else
        raise e
      end
    rescue => e
      raise e
    end 
    redirect_to api_key_credentials_path(user_domain: params[:user_domain], type: 'api_key'), :flash => {:success => "Your API key has been regenerated successfully"}
  end

  def regenerate_oauth
    @client_application = current_user.client_application
    return if request.get?
    current_user.reset_client_application!
    
    new_dashboard = current_user.has_feature_flag?('new_dashboard')
    if new_dashboard
      redirect_to oauth_credentials_path(user_domain: params[:user_domain], type: 'oauth'), :flash => {:success => "Your OAuth credentials have been updated successfully"}
    else
      redirect_to api_key_credentials_path(user_domain: params[:user_domain], type: 'oauth'), :flash => {:success => "Your OAuth credentials have been updated successfully"}
    end 
    
  end

end
{'fraction_non_alphanumeric': 0.08248950358113115, 'fraction_numerical': 0.0004939491232403062, 'mean_word_length': 3.8444976076555024, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '6716422', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1215, 'n_words': 323}