<commit_before>class BuilderController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  include(
    ApplicationHelper,
    RoutingHelper,
    UsersHelper,
    SitesHelper,
    TemplatesHelper,
    PagesHelper,
    ErrorsHelper
  )

  before_filter :authenticate_user!
  before_filter :verify_site, :except => [:home]
  before_filter :init_options
  before_filter :builder_html_title

  def home
    if has_sites? || admin?
      redirect_to(builder_sites_path)
    else
      sign_out_and_redirect(current_user)
    end
  end

  private

    def init_options
      @options = {
        'sidebar' => true,
        'body_classes' => ''
      }
    end

    def verify_site
      if current_site.nil? && request.path != builder_sites_path
        not_found
      end
    end

    def verify_admin
      not_found unless current_user.admin?
    end

end<commit_msg>fix being able to create a new site<commit_after>class BuilderController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  include(
    ApplicationHelper,
    RoutingHelper,
    UsersHelper,
    SitesHelper,
    TemplatesHelper,
    PagesHelper,
    ErrorsHelper
  )

  before_filter :authenticate_user!
  before_filter :verify_site, :except => [:home]
  before_filter :init_options
  before_filter :builder_html_title

  def home
    if has_sites? || admin?
      redirect_to(builder_sites_path)
    else
      sign_out_and_redirect(current_user)
    end
  end

  private

    def init_options
      @options = {
        'sidebar' => true,
        'body_classes' => ''
      }
    end

    def verify_site
      if(
        current_site.nil? &&
        ![builder_sites_path, new_builder_site_path].include?(request.path)
      )
        not_found
      end
    end

    def verify_admin
      not_found unless current_user.admin?
    end

end
{'fraction_non_alphanumeric': 0.06809338521400778, 'fraction_numerical': 0.0, 'mean_word_length': 2.816326530612245, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '4609723', 'n_tokens_mistral': 653, 'n_tokens_neox': 624, 'n_words': 154}