<commit_before>class Spree::WholesalersController < Spree::BaseController
  respond_to :html, :xml

  def index
  end

  def show
    @wholesaler = Spree::Wholesaler.find(params[:id])
    respond_with(@wholesaler)
  end

  def new
    @wholesaler = Spree::Wholesaler.new
    @wholesaler.build_user
    @wholesaler.bill_address = Spree::Address.default
    @wholesaler.ship_address = Spree::Address.default
    respond_with(@wholesaler)
  end

  def create
    @wholesaler = Spree::Wholesaler.new(params[:wholesaler])
    if @wholesaler.save

      # Check whether wholesaler should be auto-approved
      if Spree::Config.auto_approve_wholesaler && @wholesaler.activate!
        flash[:notice] = "Wholesale account approved for #{@wholesaler.company}. You may now place an order."
        redirect_to spree.products_path
        return
      end

      flash[:notice] = I18n.t('spree.wholesaler.signup_success')
      WholesaleMailer.new_wholesaler_email(@wholesaler).deliver
      redirect_to spree.wholesalers_path
    else
      flash[:error] = I18n.t('spree.wholesaler.signup_failed')
      render :action => "new"
    end
  end

  def edit<commit_msg>Tweaked auto_wholesale_approval after application to redirect to login instead of product page<commit_after>class Spree::WholesalersController < Spree::BaseController
  respond_to :html, :xml

  ssl_required :new, :create

  def index
  end

  def show
    @wholesaler = Spree::Wholesaler.find(params[:id])
    respond_with(@wholesaler)
  end

  def new
    @wholesaler = Spree::Wholesaler.new
    @wholesaler.build_user
    @wholesaler.bill_address = Spree::Address.default
    @wholesaler.ship_address = Spree::Address.default
    respond_with(@wholesaler)
  end

  def create
    @wholesaler = Spree::Wholesaler.new(params[:wholesaler])
    if @wholesaler.save

      # Check whether wholesaler should be auto-approved
      if Spree::Config.auto_approve_wholesaler && @wholesaler.activate!
        flash[:notice] = "Wholesale account approved for #{@wholesaler.company}. You may now sign in to place an order."
        redirect_to spree.login_path
        return
      end

      flash[:notice] = I18n.t('spree.wholesaler.signup_success')
      WholesaleMailer.new_wholesaler_email(@wholesaler).deliver
      redirect_to spree.wholesalers_path
    else
      flash[:error] = I18n.t('spree.wholesaler.signup_failed')
      render :action => "new"
    end
  end

  def edit
{'fraction_non_alphanumeric': 0.09584533113944879, 'fraction_numerical': 0.003290826820238585, 'mean_word_length': 3.650095602294455, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4250956', 'n_tokens_mistral': 814, 'n_tokens_neox': 789, 'n_words': 160}