<commit_before>get '/users/register' do
  erb :'/users/register'
end

post '/users' do
  @user = User.new(params[:user])

  if @user.save
    session[:user_id] = @user.id
    redirect '/'
  else
    @errors = @user.errors.full_messages
    redirect '/users/register'
  end
end

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

post '/login' do
  @user = User.find_by(username: params[:username])
  p @user

  if @user && @user.authenticate(params[:password])
    session[:user_id] = @user.id<commit_msg>Fix error message bug on registration page<commit_after>get '/users/register' do
  erb :'/users/register'
end

post '/users' do
  @user = User.new(params[:user])

  if @user.save
    session[:user_id] = @user.id
    redirect '/'
  else
    @errors = @user.errors.full_messages
    p @errors
    erb :'/users/register'
  end
end

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

post '/login' do
  @user = User.find_by(username: params[:username])
  p @user

  if @user && @user.authenticate(params[:password])
    session[:user_id] = @user.id
{'fraction_non_alphanumeric': 0.15670910871694418, 'fraction_numerical': 0.0, 'mean_word_length': 3.3862660944206007, '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': '5751619', 'n_tokens_mistral': 377, 'n_tokens_neox': 365, 'n_words': 91}