<commit_before>class CoachesController < ApplicationController
  get '/login' do 
    if !logged_in?
      erb :'/coaches/login'
    else
      redirect '/'
    end
  end

  post '/login' do
    coach = Coach.find_by(user_name: params[:user_name])
    if coach && coach.authenticate(params[:password])
      session[:user_id] = coach.id
      redirect "/teams/#{coach.team_id}"
    else
      redirect '/login'
    end
  end 


  get '/signup' do 
    if !logged_in?
      erb :'/coaches/new'
    else
      redirect '/'
    end
  end

  post '/signup' do 
    if params.values[0].values.include?("") || params.values[1].values.include?("") 
      redirect 'signup'
    else
      @coach = Coach.create(params[:coach])
      @team = Team.create(params[:team])
      @team.coach = @coach
      session[:user_id] = @coach.id
      redirect "/teams/#{@team.id}/build"
    end
  end

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

end<commit_msg>updated post signup to reflect new validations<commit_after>class CoachesController < ApplicationController
  get '/login' do 
    if !logged_in?
      erb :'/coaches/login'
    else
      redirect '/'
    end
  end

  post '/login' do
    coach = Coach.find_by(user_name: params[:user_name])
    if coach && coach.authenticate(params[:password])
      session[:user_id] = coach.id
      redirect "/teams/#{coach.team_id}"
    else
      redirect '/login'
    end
  end 


  get '/signup' do 
    if !logged_in?
      erb :'/coaches/new'
    else
      redirect '/'
    end
  end

  post '/signup' do 
      @coach = Coach.new(params[:coach])
      @team = Team.new(params[:team])
      if !@coach.save || !@team.save
        redirect '/signup'
      else
        session[:user_id] = @coach.id
        redirect "/teams/#{@team.id}/build"
    end
  end

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

end
{'fraction_non_alphanumeric': 0.13436006372809348, 'fraction_numerical': 0.0010621348911311736, 'mean_word_length': 2.287958115183246, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6328440', 'n_tokens_mistral': 666, 'n_tokens_neox': 640, 'n_words': 145}