<commit_before>class SessionsController < ApplicationController
  def new
    origin = { origin: session.delete(:return_to) }.to_query
    redirect_to("/auth/google_oauth2?#{origin}")
  end

  def create
    user = User.find_or_create_from_omniauth(auth_hash)
    if user.valid?
      session[:user_id] = user.id
      flash[:notice] = "Signed in!"
      # OmniAuth automatically saves the HTTP_REFERER when you begin the auth process
      redirect_to  request.env['omniauth.origin'] || root_url
    else
      flash[:error] = "You need a #{ENV.fetch('APP_DOMAIN')} account to sign in."
      redirect_to root_url
    end
  end

  def destroy
    session[:user_id] = nil<commit_msg>Simplify email domain error<commit_after>class SessionsController < ApplicationController
  def new
    origin = { origin: session.delete(:return_to) }.to_query
    redirect_to("/auth/google_oauth2?#{origin}")
  end

  def create
    user = User.find_or_create_from_omniauth(auth_hash)
    if user.valid?
      session[:user_id] = user.id
      flash[:notice] = "Signed in!"
      # OmniAuth automatically saves the HTTP_REFERER when you begin the auth process
      redirect_to  request.env['omniauth.origin'] || root_url
    else
      render text: "You need a #{ENV.fetch('APP_DOMAIN')} account to sign in."
    end
  end

  def destroy
    session[:user_id] = nil
{'fraction_non_alphanumeric': 0.1, 'fraction_numerical': 0.0014814814814814814, 'mean_word_length': 3.533557046979866, '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': '1351836', 'n_tokens_mistral': 428, 'n_tokens_neox': 419, 'n_words': 109}