class ApiSessionsController < ApiController

  def login
    user = User.authenticate(params[:email], params[:password])

    if user.nil?
      render :json => {}, :status => 422
    else
      if jkclient_agent?
        user.update_progression_field(:first_ran_client_at)
      end

      @session_only_cookie = !jkclient_agent? && 0 == params[:remember_me].to_i

      complete_sign_in(user, redirect=false)

      render :json => {}, :status => :ok
    end
  end
end
