gitlab-org--gitlab-foss/lib/api/session.rb

21 lines
505 B
Ruby
Raw Normal View History

module API
# Users API
class Session < Grape::API
# Login to get token
#
2013-07-16 04:28:19 -04:00
# Parameters:
# login (*required) - user login
# email (*required) - user email
# password (required) - user password
#
# Example Request:
# POST /session
post "/session" do
user = Gitlab::Auth.find_with_user_password(params[:email] || params[:login], params[:password])
2013-07-16 04:28:19 -04:00
return unauthorized! unless user
present user, with: Entities::UserLogin
end
end
end