<commit_before>module Omniauth
  class MultipleProvidersController < ApplicationController

    # PATH: new_omniauth_path(provider: 'twitter')
    def new
      if %w[twitter github google_oauth2 facebook].include?(params[:provider])
        redirect_to "/auth/#{params[:provider]}"
      else
        redirect_to root_path, error: "#{params[:provider]}による認証は存在しません"
      end
    end

    def create
      @user = User.find_or_create_by_oauth(env['omniauth.auth'], current_user)
      if @user.new_record?
        redirect_to new_user_session_path, flash: {error: "ユーザデータの保存に失敗しました：#{@user.errors.full_messages.join(', ')}"}
      elsif @user.email.blank?
        redirect_to new_user_registration_path(@user)
      else
        sign_in(@user)
        redirect_to root_path, notice: 'OK'
      end
    end<commit_msg>use after_sign_in_path_for when after sign_in<commit_after>module Omniauth
  class MultipleProvidersController < ApplicationController

    # PATH: new_omniauth_path(provider: 'twitter')
    def new
      if %w[twitter github google_oauth2 facebook].include?(params[:provider])
        redirect_to "/auth/#{params[:provider]}"
      else
        redirect_to root_path, error: "#{params[:provider]}による認証は存在しません"
      end
    end

    def create
      @user = User.find_or_create_by_oauth(env['omniauth.auth'], current_user)
      if @user.new_record?
        redirect_to new_user_session_path, flash: {error: "ユーザデータの保存に失敗しました：#{@user.errors.full_messages.join(', ')}"}
      elsif @user.email.blank?
        redirect_to new_user_registration_path(@user)
      else
        sign_in(@user)
        redirect_to after_sign_in_path_for(:user), notice: 'OK'
      end
    end
{'fraction_non_alphanumeric': 0.10722748815165876, 'fraction_numerical': 0.001184834123222749, 'mean_word_length': 3.5772357723577235, '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': '2649491', 'n_tokens_mistral': 579, 'n_tokens_neox': 566, 'n_words': 99}