diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-16 21:09:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-16 21:09:35 +0300 |
commit | dbfedde341ef6434d40c4c2495f2be751f8bb973 (patch) | |
tree | b99819d19e81e2c7c269005763e8840b2c5acd1f /lib/gitlab/auth | |
parent | a6533d71f53cd7f97a31100334154a82a9f37deb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/auth')
-rw-r--r-- | lib/gitlab/auth/o_auth/user.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/gitlab/auth/o_auth/user.rb b/lib/gitlab/auth/o_auth/user.rb index d9efb6b8d2d..7d9c4c0d7c1 100644 --- a/lib/gitlab/auth/o_auth/user.rb +++ b/lib/gitlab/auth/o_auth/user.rb @@ -217,7 +217,11 @@ module Gitlab def build_new_user(skip_confirmation: true) user_params = user_attributes.merge(skip_confirmation: skip_confirmation) - Users::AuthorizedBuildService.new(nil, user_params).execute + new_user = Users::AuthorizedBuildService.new(nil, user_params).execute + + persist_accepted_terms_if_required(new_user) + + new_user end def user_attributes @@ -245,6 +249,15 @@ module Gitlab } end + def persist_accepted_terms_if_required(new_user) + if Feature.enabled?(:update_oauth_registration_flow) && + Gitlab::CurrentSettings.current_application_settings.enforce_terms? + + terms = ApplicationSetting::Term.latest + Users::RespondToTermsService.new(new_user, terms).execute(accepted: true) + end + end + def sync_profile_from_provider? Gitlab::Auth::OAuth::Provider.sync_profile_from_provider?(auth_hash.provider) end |