<commit_before>class Api::V1::UsersController < Api::ApiController
  def profile
    @user = User.find_by(email: params[:email].downcase)
    unless @user
      @status = :fail
      @data = {email: "User #{params[:email]} not found."}
      render status: :not_found
    end
  end

  # Signs in an existing user, returning auth token
  # POST /sign_in
  # Leverages devise lockable module: https://github.com/plataformatec/devise/blob/master/lib/devise/models/lockable.rb
  def new_session
    @user = User.find_by(email: params[:email].downcase)
    @fail_status = :bad_request
    
    # Check if a user was found based on the passed email. If so, continue authentication.
    if @user.present?
      # checks if password is incorrect and user is locked, and unlocks if lock is expired
      if @user.valid_for_api_authentication?
        @user.ensure_authentication_token
      else<commit_msg>Handle no email passed. [BMCDOT-120]<commit_after>class Api::V1::UsersController < Api::ApiController
  def profile
    @user = User.find_by(email: params[:email].try(:downcase))
    unless @user
      @status = :fail
      @data = {email: "User #{params[:email]} not found."}
      render status: :not_found
    end
  end

  # Signs in an existing user, returning auth token
  # POST /sign_in
  # Leverages devise lockable module: https://github.com/plataformatec/devise/blob/master/lib/devise/models/lockable.rb
  def new_session
    @user = User.find_by(email: params[:email].downcase)
    @fail_status = :bad_request
    
    # Check if a user was found based on the passed email. If so, continue authentication.
    if @user.present?
      # checks if password is incorrect and user is locked, and unlocks if lock is expired
      if @user.valid_for_api_authentication?
        @user.ensure_authentication_token
      else
{'fraction_non_alphanumeric': 0.09808219178082192, 'fraction_numerical': 0.0027397260273972603, 'mean_word_length': 3.4, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4320942', 'n_tokens_mistral': 563, 'n_tokens_neox': 556, 'n_words': 165}