BigW Consortium Gitlab

session.rb 508 Bytes
Newer Older
1
module API
2 3 4 5
  # Users API
  class Session < Grape::API
    # Login to get token
    #
6 7 8 9 10
    # Parameters:
    #   login (*required) - user login
    #   email (*required) - user email
    #   password (required) - user password
    #
11 12 13
    # Example Request:
    #  POST /session
    post "/session" do
14 15
      auth = Gitlab::Auth.new
      user = auth.find(params[:email] || params[:login], params[:password])
16

17 18
      return unauthorized! unless user
      present user, with: Entities::UserLogin
19 20 21
    end
  end
end