<commit_before>require_relative 'application_controller'

class UsersController < ApplicationController
  get '/login' do
    if !logged_in?
      erb :'/users/login'
    else
      redirect to "/"
    end
  end

  get '/logout' do
    if logged_in?
      session.clear
      redirect to "/login"
    else
      redirect to "/"
    end
  end

  post '/login' do
    redirect to "/" if logged_in?

    user = User.find_by(username: params[:username])

    if user && user.authenticate(params[:password])
      session[:user_id] = user.id
      redirect to "/users/#{user.id}"
    else
      flash[:login_errors] = "Please provide a valid username and password."
      erb :"/users/login"
    end
  end

  get '/users/:id' do
    @user = User.find_by(id: params[:id])

    if @user && logged_in? && @user.id == current_user.id
      erb :'users/show'
    else
      redirect to "/"
    end
  end
end
<commit_msg>Add missed change from UsersController<commit_after>require_relative 'application_controller'

class UsersController < ApplicationController
  get '/users/:id' do
    @user = User.find_by(id: params[:id])

    if @user && logged_in? && @user.id == current_user.id
      erb :'users/show'
    else
      redirect to "/"
    end
  end
end

{'fraction_non_alphanumeric': 0.11868484362469928, 'fraction_numerical': 0.0, 'mean_word_length': 2.617391304347826, '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': '5377072', 'n_tokens_mistral': 406, 'n_tokens_neox': 397, 'n_words': 109}