<commit_before>class SessionsController < ApplicationController

  def login
  end

  def begin
    user = Session.login_by_username_or_email(params[:user_input])

    if user && user.authenticate(params[:password])
      respond_to do |format|
        format.json { render json: ActiveSupport::JSON.encode(user), status: 200}
        format.html {
          session[:user_id] = user.id
          flash[:success] = "Welcome, #{user.username}!"
          redirect_to root_path
        }
       end
    else
      respond_to do |format|
        format.json { render json: 'login failed', status: 400}
        format.html {
          flash[:failure] = "Login failed."
          render :login
        }
       end
    end
  end

  def end
    session[:user_id] = nil
    redirect_to root_path<commit_msg>Change path after user creation to user path<commit_after>class SessionsController < ApplicationController

  def login
  end

  def begin
    user = Session.login_by_username_or_email(params[:user_input])

    if user && user.authenticate(params[:password])
      respond_to do |format|
        format.json { render json: ActiveSupport::JSON.encode(user), status: 200}
        format.html {
          session[:user_id] = user.id
          flash[:success] = "Welcome, #{user.username}!"
          redirect_to user_path(user)
        }
       end
    else
      respond_to do |format|
        format.json { render json: 'login failed', status: 400}
        format.html {
          flash[:failure] = "Login failed."
          render :login
        }
       end
    end
  end

  def end
    session[:user_id] = nil
    redirect_to root_path
{'fraction_non_alphanumeric': 0.09529627367135003, 'fraction_numerical': 0.007330482590103849, 'mean_word_length': 2.342857142857143, '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': '1870052', 'n_tokens_mistral': 487, 'n_tokens_neox': 460, 'n_words': 120}