summaryrefslogtreecommitdiff
path: root/app/controllers/api/v1/logins_controller.rb
blob: 9e5b0c16b75590ac15e7b47004d3f2b5a229cad4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module Api
  module V1
    class LoginsController < ApplicationController
      def create
        @user = User.find_by_email(params[:email])
        if @user.authenticate(params[:password])
          render json: { auth_token: @user.authentication_token }
        else
          render json: { auth_token: "" }
        end
      end
    end
  end
end