<commit_before>class SetupsController < ApplicationController

  skip_before_filter :authenticate_user
  before_filter :check_setup_requirements

  def show
    redirect_to new_setup_path
  end

  def new
    generate_encryption_key
    @person = Person.new
  end

  def create
    Person.transaction do
      @person = Person.new
      if params[:domain_name].to_s.any?
        Site.current.host = params[:domain_name]
        Site.current.save
      else
        generate_encryption_key
        @person.errors.add :base, t('setup.invalid_domain_name')
        render :action => 'new'
        return
      end
      @person.attributes = params[:person]
      @person.password = params[:encrypted_password].to_s.any? ? decrypt_password(params[:encrypted_password]) : nil
      @person.password_confirmation = params[:encrypted_password_confirmation].to_s.any? ? decrypt_password(params[:encrypted_password_confirmation]) : nil
      unless @person.password and @person.password == @person.password_confirmation
        generate_encryption_key
        @person.errors.add :error, t('accounts.set_password_error')
        render :action => 'new'
        return
      end
      unless @person.email.to_s.any?
        generate_encryption_key
        @person.errors.add :email, t('activerecord.errors.models.person.attributes.email.invalid')
        render :action => 'new'
        return
      end
      @person.can_sign_in = true
      @person.visible_to_everyone = true
      @person.visible_on_printed_directory = true
      @person.full_access = true
      @person.child = false
      @person.family = Family.create!(
        :name      => @person.name,
        :last_name => @person.last_name
      )
      @person.admin = Admin.create!(:super_admin => true)
      if @person.save
        Setting.set_global('Contact', 'Bug Notification Email', @person.email)
        Setting.set_global('Contact', 'Tech Support Email', @person.email)
        flash[:notice] = t('setup.complete')
        redirect_to new_session_path(:from => '/stream')
      else
        generate_encryption_key<commit_msg>del famile<commit_after>class SetupsController < ApplicationController

  skip_before_filter :authenticate_user
  before_filter :check_setup_requirements

  def show
    redirect_to new_setup_path
  end

  def new
    generate_encryption_key
    @person = Person.new
  end

  def create
    Person.transaction do
      @person = Person.new
      if params[:domain_name].to_s.any?
        Site.current.host = params[:domain_name]
        Site.current.save
      else
        generate_encryption_key
        @person.errors.add :base, t('setup.invalid_domain_name')
        render :action => 'new'
        return
      end
      @person.attributes = params[:person]
      @person.password = params[:encrypted_password].to_s.any? ? decrypt_password(params[:encrypted_password]) : nil
      @person.password_confirmation = params[:encrypted_password_confirmation].to_s.any? ? decrypt_password(params[:encrypted_password_confirmation]) : nil
      unless @person.password and @person.password == @<PASSWORD>
        generate_encryption_key
        @person.errors.add :error, t('accounts.set_password_error')
        render :action => 'new'
        return
      end
      unless @person.email.to_s.any?
        generate_encryption_key
        @person.errors.add :email, t('activerecord.errors.models.person.attributes.email.invalid')
        render :action => 'new'
        return
      end
      @person.can_sign_in = true
      @person.visible_to_everyone = true
      @person.visible_on_printed_directory = true
      @person.full_access = true
      @person.child = false

      @person.admin = Admin.create!(:super_admin => true)
      if @person.save
        Setting.set_global('Contact', 'Bug Notification Email', @person.email)
        Setting.set_global('Contact', 'Tech Support Email', @person.email)
        flash[:notice] = t('setup.complete')
        redirect_to new_session_path(:from => '/stream')
      else
        generate_encryption_key
{'fraction_non_alphanumeric': 0.10076751671205744, 'fraction_numerical': 0.0, 'mean_word_length': 3.011916583912612, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 16, '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': '4023779', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1162, 'n_words': 218}