<commit_before>class UsersController < ApplicationController

  get '/signup' do
    if !logged_in?
      erb :'/users/signup'
    else
      erb :'instruments/instruments'
    end
  end

  post '/signup' do
    if params[:password] == ""
      redirect '/signup'
    flash[:message] = "You must create a password."
    end
    user = User.new(params)
    if user.username != "" && user.email != ""
      user.save
      session[:user_id] = user.id
      redirect to "/instruments"
    else
      redirect to '/signup'
    end
  end


  get '/login' do
  if logged_in?
    redirect to '/instruments'
  else
    erb :'/users/login'
  end
end

end<commit_msg>working on post user login<commit_after>class UsersController < ApplicationController

  get '/signup' do
    if !logged_in?
      erb :'/users/signup'
    else
      erb :'instruments/instruments'
    end
  end

  post '/signup' do
    if params[:password] == ""
      redirect '/signup'
    flash[:message] = "You must create a password."
    end
    user = User.new(params)
    if user.username != "" && user.email != ""
      user.save
      session[:user_id] = user.id
      redirect to "/instruments"
    else
      redirect to '/signup'
    end
  end

  get '/login' do
    if logged_in?
      redirect to '/instruments'
    else
      erb :'/users/login'
    end
  end

  post '/login' do
    @user = User.find_by(:username => params[:username])
    if @user && @user.authenticate(params[:password])
      session[:user_id] = @user.id
      redirect "/instruments"
    else
      erb :'/users/login'
    end
 end

end
{'fraction_non_alphanumeric': 0.12262958280657396, 'fraction_numerical': 0.0, 'mean_word_length': 2.291060291060291, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '5306196', 'n_tokens_mistral': 524, 'n_tokens_neox': 509, 'n_words': 141}