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

post '/login' do
  user = User.find_by(username: params[:user][:username]).try(:authenticate, params[:user][:password])
  if user
    session[:user_id] = user.id
    redirect "/"
  else
    set_error('Login failed')
    redirect '/login'
  end
end

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

post '/signup' do
  user = User.new(params[:user])
  if user.save
    session[:user_id] = user.id
    redirect "/"
  else
    redirect '/signup'
  end
end

get '/logout' do
  session[:user_id] = nil
  redirect '/'
end<commit_msg>Added route for users Profile page<commit_after>get '/login' do
  erb :'user/login'
end

post '/login' do
  user = User.find_by(username: params[:user][:username]).try(:authenticate, params[:user][:password])
  if user
    session[:user_id] = user.id
    redirect "/"
  else
    set_error('Login failed')
    redirect '/login'
  end
end

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

post '/signup' do
  user = User.new(params[:user])
  if user.save
    session[:user_id] = user.id
    redirect "/"
  else
    redirect '/signup'
  end
end

get '/profile/:id' do |id|
  @user = User.find(id)
  if @user.id == session[:user_id]
    erb :'user/profile'
  else
    if session[:user_id]
      redirect '/'
    else
      redirect '/login'
    end
  end
end

get '/logout' do
  session[:user_id] = nil
  redirect '/'
end
{'fraction_non_alphanumeric': 0.15129682997118155, 'fraction_numerical': 0.0, 'mean_word_length': 3.06140350877193, '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': '625041', 'n_tokens_mistral': 511, 'n_tokens_neox': 509, 'n_words': 131}