summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-11-10 09:54:23 +0000
committerRémy Coutable <remy@rymai.me>2016-11-10 09:54:23 +0000
commite3dcd83d4a4b75dc050592ea008dc34ecbe0aa49 (patch)
treed9f7b417dd386c2fa166661f5c3392c5f4908a5b /lib/api
parenta29544f5fee8ba65fcfea0689b0c60b77d8784ab (diff)
parent603ebe55f0232f16b5f1db95d2962a4cf5cdcc1b (diff)
downloadgitlab-ce-e3dcd83d4a4b75dc050592ea008dc34ecbe0aa49.tar.gz
Merge branch 'grapify-session-api' into 'master'
Grapify the session API ## What are the relevant issue numbers? Related to #22928 See merge request !7381
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/session.rb19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/api/session.rb b/lib/api/session.rb
index 55ec66a6d67..d09400b81f5 100644
--- a/lib/api/session.rb
+++ b/lib/api/session.rb
@@ -1,15 +1,14 @@
module API
- # Users API
class Session < Grape::API
- # Login to get token
- #
- # Parameters:
- # login (*required) - user login
- # email (*required) - user email
- # password (required) - user password
- #
- # Example Request:
- # POST /session
+ desc 'Login to get token' do
+ success Entities::UserLogin
+ end
+ params do
+ optional :login, type: String, desc: 'The username'
+ optional :email, type: String, desc: 'The email of the user'
+ requires :password, type: String, desc: 'The password of the user'
+ at_least_one_of :login, :email
+ end
post "/session" do
user = Gitlab::Auth.find_with_user_password(params[:email] || params[:login], params[:password])