<commit_before>class Api::V1::SessionsController < ApplicationController
  skip_before_filter :verify_authenticity_token
  respond_to :json

  def create
    email = params[:email]
    password = params[:password]

    # Checking whether format is json or not
    if request.format != :json
      render status: 406, json: { message: t(:not_json) }
      return
    end

    # Checking for empty email or password
    if email.nil? or password.nil?
      render status: 400, json: { message: t(:empty_input) }
      return
    end

    @user = User.find_by_email(email.downcase)

    # Checking whether user exists
    if @user.nil?
      render status: 401, json: { message: t(:invalid_field) }
      return
    end

    @user.ensure_authentication_token!

    # Finally, checking for password
    if not @user.valid_password?(password)
      render status: 401, json: { message: t(:invalid_field) }
    else
      render status: 200, json: { 'success' => true, 
                                  'id' => @user.id, 
                                  'auth_token' => @user.authentication_token, 
                                  'email' => @user.email}.to_json
    end

  end
<commit_msg>#1 Fix email parameter<commit_after>class Api::V1::SessionsController < ApplicationController
  skip_before_filter :verify_authenticity_token
  respond_to :json

  def create
    email = params[:email]
    password = params[:password]

    # Checking whether format is json or not
    if request.format != :json
      render status: 406, json: { message: t(:not_json) }
      return
    end

    # Checking for empty email or password
    if email.nil? or password.nil?
      render status: 400, json: { message: t(:empty_input) }
      return
    end

    @user = User.find_by_email(email: email.downcase)

    # Checking whether user exists
    if @user.nil?
      render status: 401, json: { message: t(:invalid_field) }
      return
    end

    @user.ensure_authentication_token!

    # Finally, checking for password
    if not @user.valid_password?(password)
      render status: 401, json: { message: t(:invalid_field) }
    else
      render status: 200, json: { 'success' => true, 
                                  'id' => @user.id, 
                                  'auth_token' => @user.authentication_token, 
                                  'email' => @user.email}.to_json
    end

  end

{'fraction_non_alphanumeric': 0.09690893901420217, 'fraction_numerical': 0.013784461152882205, 'mean_word_length': 2.258503401360544, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4033252', 'n_tokens_mistral': 735, 'n_tokens_neox': 678, 'n_words': 192}