OSDN Git Service
(root)
/
wvm
/
gitlab.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Refactor API classes. So api classes like Gitlab::Issues become API::Issues
[wvm/gitlab.git]
/
lib
/
api
/
session.rb
1
module API
2
# Users API
3
class Session < Grape::API
4
# Login to get token
5
#
6
# Example Request:
7
# POST /session
8
post "/session" do
9
resource = User.find_for_database_authentication(email: params[:email])
10
11
return unauthorized! unless resource
12
13
if resource.valid_password?(params[:password])
14
present resource, with: Entities::UserLogin
15
else
16
unauthorized!
17
end
18
end
19
end
20
end