summaryrefslogtreecommitdiff
path: root/config/initializers
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-01-13 19:56:43 +0000
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-01-13 19:56:43 +0000
commitbe9f5589ed96cb7baeb6ee2bcc5f4a704573675d (patch)
tree64af2526be0a3467e0532781b6d1b03db99d903a /config/initializers
parent1e37e8924ab38cfbb2a838c2bc6589b03f72dbcd (diff)
parentf07b165ab7b0834eadbe05da81fc167dcc23d59d (diff)
downloadgitlab-ce-be9f5589ed96cb7baeb6ee2bcc5f4a704573675d.tar.gz
Merge branch 'oauth_api_doc' into 'master'
OAuth2 API documentation https://dev.gitlab.org/gitlab/gitlabhq/issues/1713 See merge request !1388
Diffstat (limited to 'config/initializers')
-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.