<commit_before>get '/login' do
  erb :'/auth/login'
end

get '/signup' do
  erb :'/auth/signup'
end

post '/login' do
  @user = User.find_by(username: params[:username])
  if @user.password == params[:password]
    session[:user_id] = @user.id
    redirect '/decks'
  else
    @error_message = true
    erb :'/auth/login'
  end
end

post '/signup' do
  user = User.create(params[:user])
  if user.save
    session[:user_id] = user.id
    redirect '/decks'
  else
    @username_taken = true
    erb :'/auth/signup'
  end
end

delete '/logout' do
  session.clear
  redirect '/'
end
<commit_msg>updated the auth controller so you get an error when you login with wrong user or password<commit_after>require 'pry'
get '/login' do
  erb :'/auth/login'
end

get '/signup' do
  erb :'/auth/signup'
end

post '/login' do
  @user = User.find_by(username: params[:username])
  if @user == nil
    @error_message = true
    erb :'/auth/login'
  elsif @user.password == params[:password]
    session[:user_id] = @user.id
    redirect '/decks'
  end
end

post '/signup' do
  user = User.create(params[:user])
  if user.save
    session[:user_id] = user.id
    redirect '/decks'
  else
    @username_taken = true
    erb :'/auth/signup'
  end
end

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

{'fraction_non_alphanumeric': 0.13886733902249807, 'fraction_numerical': 0.0, 'mean_word_length': 3.0822784810126582, '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': '201534', 'n_tokens_mistral': 480, 'n_tokens_neox': 469, 'n_words': 132}