<commit_before>class SessionsController < ApplicationController

  def new

  end

  def create
    @user = User.find_by(username: sessions_params[:username])
    .try(:authenticate, sessions_params[:password])

    if @user
      session[:user_id] = @user.id
      redirect_to login_path  # BUGBUG redirect spot_index_path? (route for spots not yet defined)
    else
      flash[:login] = "Invalid Credentials"
      redirect_to login_path
    end
  end

  def destroy
    session.clear
    redirect_to login_path
  end

  private

  def sessions_params
    params.require(:session).permit(:username, :password)
  end
end
<commit_msg>Redirect logout and login to spots_path<commit_after>class SessionsController < ApplicationController

  def new

  end

  def create
    @user = User.find_by(username: sessions_params[:username])
    .try(:authenticate, sessions_params[:password])

    if @user
      session[:user_id] = @user.id
      redirect_to spots_path
    else
      flash[:login] = "Invalid Credentials"
      redirect_to login_path
    end
  end

  def destroy
    session.clear
    redirect_to spots_path
  end

  private

  def sessions_params
    params.require(:session).permit(:username, :password)
  end
end

{'fraction_non_alphanumeric': 0.0766721044045677, 'fraction_numerical': 0.0, 'mean_word_length': 3.3978494623655915, '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': '806944', 'n_tokens_mistral': 377, 'n_tokens_neox': 356, 'n_words': 94}