summaryrefslogtreecommitdiff
path: root/lib/gitlab/auth/o_auth/user.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 11:59:07 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 11:59:07 +0000
commit8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch)
tree544930fb309b30317ae9797a9683768705d664c4 /lib/gitlab/auth/o_auth/user.rb
parent4b1de649d0168371549608993deac953eb692019 (diff)
downloadgitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'lib/gitlab/auth/o_auth/user.rb')
-rw-r--r--lib/gitlab/auth/o_auth/user.rb19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/gitlab/auth/o_auth/user.rb b/lib/gitlab/auth/o_auth/user.rb
index 3211d2ffaea..f556a7f40e9 100644
--- a/lib/gitlab/auth/o_auth/user.rb
+++ b/lib/gitlab/auth/o_auth/user.rb
@@ -9,6 +9,16 @@ module Gitlab
module Auth
module OAuth
class User
+ class << self
+ # rubocop: disable CodeReuse/ActiveRecord
+ def find_by_uid_and_provider(uid, provider)
+ identity = ::Identity.with_extern_uid(provider, uid).take
+
+ identity && identity.user
+ end
+ # rubocop: enable CodeReuse/ActiveRecord
+ end
+
SignupDisabledError = Class.new(StandardError)
SigninDisabledForProviderError = Class.new(StandardError)
@@ -190,15 +200,12 @@ module Gitlab
@auth_hash = AuthHash.new(auth_hash)
end
- # rubocop: disable CodeReuse/ActiveRecord
def find_by_uid_and_provider
- identity = Identity.with_extern_uid(auth_hash.provider, auth_hash.uid).take
- identity&.user
+ self.class.find_by_uid_and_provider(auth_hash.uid, auth_hash.provider)
end
- # rubocop: enable CodeReuse/ActiveRecord
- def build_new_user
- user_params = user_attributes.merge(skip_confirmation: true)
+ def build_new_user(skip_confirmation: true)
+ user_params = user_attributes.merge(skip_confirmation: skip_confirmation)
Users::BuildService.new(nil, user_params).execute(skip_authorization: true)
end