diff options
Diffstat (limited to 'lib/gitlab/auth/o_auth/user.rb')
-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 |