<commit_before># frozen_string_literal: true
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
  def github
    user = User.find_or_create_for_github_oauth(request.env['omniauth.auth'])

    if user.just_created? || !user.valid? || user.github_import
      sign_in user
      redirect_to edit_user_path(user, welcome: true)
    elsif user.persisted?
      flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', kind: 'Github'
      sign_in_and_redirect user, event: :authentication
    else
      session['devise.github_data'] = request.env['omniauth.auth']
      redirect_to new_user_registration_url
    end
  end
end<commit_msg>Step 1: direct more users to their edit profile page<commit_after># frozen_string_literal: true
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
  def github
    user = User.find_or_create_for_github_oauth(request.env['omniauth.auth'])

    if user.just_created? || !user.valid? || user.github_import || !user.confirmed? || user.email.nil? || user.github_id.nil?
      sign_in user
      redirect_to edit_user_path(user, welcome: true)
    elsif user.persisted?
      flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', kind: 'Github'
      sign_in_and_redirect user, event: :authentication
    else
      session['devise.github_data'] = request.env['omniauth.auth']
      redirect_to new_user_registration_url  # this route doesn't go anywhere (we don't use Devise registerable module)
    end
  end
end
{'fraction_non_alphanumeric': 0.09698996655518395, 'fraction_numerical': 0.0033444816053511705, 'mean_word_length': 4.54074074074074, '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': '6073827', 'n_tokens_mistral': 488, 'n_tokens_neox': 469, 'n_words': 100}