<commit_before>get '/signup' do
  erb :'users/new'
end

post '/users' do
  user = User.new(params[:user])
  if user.save
    session[:user_id] = user.id
    redirect "/users/#{user.id}"
  else
    @errors = user.errors.full_messages
    erb :'users/new'
  end
end

get '/login' do
  erb :'users/login'
end

post '/login' do
  @user = User.find_by(username: params[:user][:username])
  if @user.password == params[:password]
    session[:user_id] = @user.id
    redirect '/'
  else
    @errors = @user.errors.full_messages
    redirect '/login'
  end
end

get '/logout' do
  session.clear
  redirect '/'
end<commit_msg>add path to user profile<commit_after>get '/signup' do
  erb :'users/new'
end

post '/users' do
  user = User.new(params[:user])
  if user.save
    session[:user_id] = user.id
    redirect "/users/#{user.id}"
  else
    @errors = user.errors.full_messages
    erb :'users/new'
  end
end

get '/login' do
  erb :'users/login'
end

post '/login' do
  @user = User.find_by(username: params[:user][:username])
  if @user.password == params[:password]
    session[:user_id] = @user.id
    redirect '/'
  else
    @errors = @user.errors.full_messages
    redirect '/login'
  end
end

get '/logout' do
  session.clear
  redirect '/'
end

get '/users/:id' do
  # if logged_in?
    @user = User.find_by(id: params[:id])
    erb :'users/show'
  # else
  #   add error page (partial)
  end
end
{'fraction_non_alphanumeric': 0.15285714285714286, 'fraction_numerical': 0.0, 'mean_word_length': 3.0608695652173914, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5490167', 'n_tokens_mistral': 522, 'n_tokens_neox': 522, 'n_words': 130}