<commit_before>class AccountController < ApplicationController
  before_action :authenticate_user!, except: [:consent, :privacy_policy, :terms_and_conditions, :terms_of_access]

  def get_started
  end

  def get_started_privacy
  end

  def get_started_terms_of_access
  end

  def get_started_provider_profile
  end

  def get_started_social_profile
    current_user.create_social_profile
  end

  def get_started_consent
  end

  def get_started_about_me
    if current_user
      @survey = Survey.find_by_slug("about-me")
      @answer_session = AnswerSession.find_or_create(current_user, @survey)
    end
  end

  def accepts_terms_of_access
    current_user.update accepted_terms_of_access_at: Time.zone.now
    if current_user.provider?
      redirect_to get_started_provider_profile_path
    elsif current_user.is_only_researcher?
      redirect_to get_started_social_profile_path
    else
      redirect_to home_path
    end
  end

  def privacy_policy
    if params[:privacy_policy_read]
      current_user.update accepted_privacy_policy_at: Time.zone.now
      if current_user.ready_for_research?
        redirect_to (session[:return_to].present? ? session.delete(:return_to) : surveys_path), notice: "You have now signed the consent and are ready to participate in research. You can opt out any time by visiting your user account settings."
      else
        redirect_to consent_path, notice: "Please read over and accept the research consent before participating in research."
      end
    else
      load_content
    end
  end

  def accepts_privacy
    current_user.update accepted_privacy_policy_at: Time.zone.now
    if !current_user.ready_for_research?
      redirect_to get_started_consent_path
    elsif current_user.is_only_academic?
      redirect_to get_started_terms_of_access_path<commit_msg>Providers properly forwarded to ToA during get started path, found while testing #406<commit_after>class AccountController < ApplicationController
  before_action :authenticate_user!, except: [:consent, :privacy_policy, :terms_and_conditions, :terms_of_access]

  def get_started
  end

  def get_started_privacy
  end

  def get_started_terms_of_access
  end

  def get_started_provider_profile
  end

  def get_started_social_profile
    current_user.create_social_profile
  end

  def get_started_consent
  end

  def get_started_about_me
    if current_user
      @survey = Survey.find_by_slug("about-me")
      @answer_session = AnswerSession.find_or_create(current_user, @survey)
    end
  end

  def accepts_terms_of_access
    current_user.update accepted_terms_of_access_at: Time.zone.now
    if current_user.provider?
      redirect_to get_started_provider_profile_path
    elsif current_user.is_only_researcher?
      redirect_to get_started_social_profile_path
    else
      redirect_to home_path
    end
  end

  def privacy_policy
    if params[:privacy_policy_read]
      current_user.update accepted_privacy_policy_at: Time.zone.now
      if current_user.ready_for_research?
        redirect_to (session[:return_to].present? ? session.delete(:return_to) : surveys_path), notice: "You have now signed the consent and are ready to participate in research. You can opt out any time by visiting your user account settings."
      else
        redirect_to consent_path, notice: "Please read over and accept the research consent before participating in research."
      end
    else
      load_content
    end
  end

  def accepts_privacy
    current_user.update accepted_privacy_policy_at: Time.zone.now
    if current_user.is_only_academic? and !current_user.ready_for_research?
      redirect_to get_started_terms_of_access_path
    elsif !current_user.ready_for_research?
      redirect_to get_started_consent_path
{'fraction_non_alphanumeric': 0.04562433297758805, 'fraction_numerical': 0.0008004268943436499, 'mean_word_length': 4.206944444444445, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2348700', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1120, 'n_words': 275}