<commit_before>get '/' do
  erb :_welcome
end

get '/auth/login' do
  erb :"auth/_login", layout: false
end

post '/auth/login' do
  p params[:user][:email]
  p params[:user][:password]
  @user = User.find_by(email: params[:user][:email]).try(:authenticate, params[:user][:password])
  p @user
  # .try(:authenticate(params[:user][:password]))
  set_session
  {path: "/users/#{current_user.id}"}.to_json
  # User.find_by(name: 'david').try(:authenticate, 'notright')
end

get '/users/new' do
  erb :"auth/_signup", layout: false
end

post '/users' do
  @user = User.create(params[:user])
  set_session
  {path: "/users/#{current_user.id}"}.to_json
  # if @user
  #   set_session
  # else
  #   redirect '/login'
  # end
end

get '/auth/logout' do
  session.clear
  redirect '/'
end<commit_msg>Add auth update and delete routes<commit_after>get '/' do
  erb :_welcome
end

get '/auth/login' do
  erb :"auth/_login", layout: false
end

post '/auth/login' do
  p params[:user][:email]
  p params[:user][:password]
  @user = User.find_by(email: params[:user][:email]).try(:authenticate, params[:user][:password])
  if p @user
    set_session
    {path: "/users/#{current_user.id}"}.to_json
  else
    401
  end
end

get '/users/new' do
  erb :"auth/_signup", layout: false
end

post '/users' do
  @user = User.create(params[:user])
  set_session
  {path: "/users/#{current_user.id}"}.to_json
end

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

{'fraction_non_alphanumeric': 0.17655172413793102, 'fraction_numerical': 0.0020689655172413794, 'mean_word_length': 3.986254295532646, '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': '1514570', 'n_tokens_mistral': 554, 'n_tokens_neox': 547, 'n_words': 125}