summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/auth.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb
index 7f7bdda953f..8a68808d9fd 100644
--- a/lib/gitlab/auth.rb
+++ b/lib/gitlab/auth.rb
@@ -164,20 +164,18 @@ module Gitlab
Gitlab::Auth::Result.new(user, nil, :gitlab_or_ldap, full_authentication_abilities)
end
- # rubocop: disable CodeReuse/ActiveRecord
def oauth_access_token_check(login, password)
if login == "oauth2" && password.present?
token = Doorkeeper::AccessToken.by_token(password)
if valid_oauth_token?(token)
- user = User.find_by(id: token.resource_owner_id)
- return unless user.can?(:log_in)
+ user = User.id_in(token.resource_owner_id).first
+ return unless user&.can?(:log_in)
Gitlab::Auth::Result.new(user, nil, :oauth, full_authentication_abilities)
end
end
end
- # rubocop: enable CodeReuse/ActiveRecord
def personal_access_token_check(password)
return unless password.present?