<commit_before>class SessionsController < ApplicationController

  def create
  	if Artist.find_by(email: params[:session][:email]).present?
  		user = Artist.find_by(email: params[:session][:email])
  		if user && user.authenticate(params[:session][:password])
  			session[:artist_id] = user.id
  			redirect_to artist_path(user)
  		else
  			redirect_to '/login'
  		end

  	elsif Organization.find_by(email: params[:session][:email]).present?
  		user = Organization.find_by(email: params[:session][:email])
  		if user && user.authenticate(params[:session][:password])
  			session[:organization_id] = user.id
  			redirect_to organization_path(user)
  		else
  			redirect_to '/login'
  		end
  	else
 		flash.now[:danger] = 'Invalid email/password combination'
 		redirect_to '/login'
  	end
  end

  def destroy
    if session[:artist_id]
  	  session[:artist_id] = nil
    else
      session[:organization_id] = nil
    end
  	redirect_to root_path
  end

end<commit_msg>Add silent fail on failed login<commit_after>class SessionsController < ApplicationController
  def create
    if Artist.find_by(email: params[:session][:email]).present?
      @user = Artist.find_by(email: params[:session][:email])
      if @user && @user.authenticate(params[:session][:password])
        session[:artist_id] = @user.id
        redirect_to artist_path(@user)
      else
        # render json: "{error: 'Invalid email/password combination'}"
        redirect_to root_path
      end

    elsif Organization.find_by(email: params[:session][:email]).present?
      @user = Organization.find_by(email: params[:session][:email])
      if @user && @user.authenticate(params[:session][:password])
        session[:organization_id] = @user.id
        redirect_to organization_path(@user)
      else
        # render json: "{error: 'Invalid email/password combination'}"
        redirect_to root_path
      end
    else
      # render json: "{error: 'Invalid email/password combination'}"
      redirect_to root_path
    end
  end

  def destroy
    if session[:artist_id]
      session[:artist_id] = nil
    else
      session[:organization_id] = nil
    end
    redirect_to root_path
  end
end
{'fraction_non_alphanumeric': 0.11492673992673992, 'fraction_numerical': 0.0, 'mean_word_length': 3.4774590163934427, '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': '4923520', 'n_tokens_mistral': 697, 'n_tokens_neox': 672, 'n_words': 142}