<commit_before>class UserSessionsController < ApplicationController
  def new
    # if current_user
    #   redirect_to :controller => :clientes, :action => :new
    # end
  end

  def create 
    if @user = login(params[:username], params[:password])
      if @user.suspendido
        logout
        redirect_to login_path
        flash[:error] = "Usuario suspendido"
      else
        case @user.rol
        when Rol.administrador_estadistica
          redirect_to pacientes_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        when Rol.administrador
          redirect_to productos_alerta_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        when Rol.vendedor
          redirect_to productos_alerta_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        when Rol.doctor
          redirect_to doctors_dashboard_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        when Rol.administrador_enfermeria
          redirect_to dashboard_enfermeria_index_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        when Rol.enfermera
          redirect_to dashboard_enfermeria_index_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        end
      end
    else
      flash[:error] = "Usuario o contraseña inválido"
      redirect_to login_path
    end
  end

  def destroy
    logout
    redirect_to login_path, notice: "Has Cerrado Sesión"
  end
end<commit_msg>added new rol<commit_after>class UserSessionsController < ApplicationController
  def new
    # if current_user
    #   redirect_to :controller => :clientes, :action => :new
    # end
  end

  def create 
    if @user = login(params[:username], params[:password])
      if @user.suspendido
        logout
        redirect_to login_path
        flash[:error] = "Usuario suspendido"
      else
        case @user.rol
        when Rol.administrador_estadistica
          redirect_to pacientes_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        when Rol.administrador_farmacia
          redirect_to productos_alerta_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        when Rol.administrador_enfermeria
          redirect_to dashboard_enfermeria_index_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        when Rol.auxiliar_estadistica
          redirect_to pacientes_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        when Rol.vendedor
          redirect_to productos_alerta_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        when Rol.doctor
          redirect_to doctors_dashboard_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        when Rol.enfermera
          redirect_to dashboard_enfermeria_index_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        when Rol.administrador
          redirect_to productos_alerta_path
          flash[:notice] = "Bienvenido #{current_user.username}"
        end
      end
    else
      flash[:error] = "Usuario o contraseña inválido"
      redirect_to login_path
    end
  end

  def destroy
    logout
    redirect_to login_path, notice: "Has Cerrado Sesión"
  end
end
{'fraction_non_alphanumeric': 0.07558671136848522, 'fraction_numerical': 0.0, 'mean_word_length': 2.6426193118756935, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4141925', 'n_tokens_mistral': 964, 'n_tokens_neox': 962, 'n_words': 207}