summaryrefslogtreecommitdiff
path: root/config/initializers/doorkeeper.rb
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2015-01-12 15:30:34 -0800
committerValery Sizov <valery@gitlab.com>2015-01-12 19:29:06 -0800
commitf07b165ab7b0834eadbe05da81fc167dcc23d59d (patch)
tree4f058527c976dfc9512d70dc62c3f986912980ab /config/initializers/doorkeeper.rb
parent1c6a1253899219b84cc9cb8b090a3bfbbd19605e (diff)
downloadgitlab-ce-f07b165ab7b0834eadbe05da81fc167dcc23d59d.tar.gz
OAuth API documentation update
Diffstat (limited to 'config/initializers/doorkeeper.rb')
-rw-r--r--config/initializers/doorkeeper.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb
index b2db3a7ea7e..536c849421e 100644
--- a/config/initializers/doorkeeper.rb
+++ b/config/initializers/doorkeeper.rb
@@ -10,6 +10,11 @@ Doorkeeper.configure do
current_user || redirect_to(new_user_session_url)
end
+ resource_owner_from_credentials do |routes|
+ u = User.find_by(email: params[:username])
+ u if u && u.valid_password?(params[:password])
+ end
+
# If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below.
# admin_authenticator do
# # Put your admin authentication logic here.