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 | |
parent | a6533d71f53cd7f97a31100334154a82a9f37deb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/auth/o_auth/user.rb | 15 | ||||
-rw-r--r-- | lib/gitlab/rack_attack.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/themes.rb | 4 |
3 files changed, 18 insertions, 5 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 diff --git a/lib/gitlab/rack_attack.rb b/lib/gitlab/rack_attack.rb index b2664f87306..f5fb6b5af3d 100644 --- a/lib/gitlab/rack_attack.rb +++ b/lib/gitlab/rack_attack.rb @@ -12,9 +12,9 @@ module Gitlab rack_attack::Request.include(Gitlab::RackAttack::Request) # This is Rack::Attack::DEFAULT_THROTTLED_RESPONSE, modified to allow a custom response - rack_attack.throttled_response = lambda do |env| + rack_attack.throttled_responder = lambda do |request| throttled_headers = Gitlab::RackAttack.throttled_response_headers( - env['rack.attack.matched'], env['rack.attack.match_data'] + request.env['rack.attack.matched'], request.env['rack.attack.match_data'] ) [429, { 'Content-Type' => 'text/plain' }.merge(throttled_headers), [Gitlab::Throttle.rate_limiting_response_text]] end diff --git a/lib/gitlab/themes.rb b/lib/gitlab/themes.rb index 228da9ee370..ec2ec0d801f 100644 --- a/lib/gitlab/themes.rb +++ b/lib/gitlab/themes.rb @@ -23,8 +23,8 @@ module Gitlab Theme.new(8, s_('NavigationTheme|Light Green'), 'ui-light-green', 'theme_light_green', '#156b39'), Theme.new(9, s_('NavigationTheme|Red'), 'ui-red', 'theme_red', '#691a16'), Theme.new(10, s_('NavigationTheme|Light Red'), 'ui-light-red', 'theme_light_red', '#a62e21'), - Theme.new(2, s_('NavigationTheme|Dark'), 'ui-dark', 'theme_dark', '#303030'), - Theme.new(3, s_('NavigationTheme|Light'), 'ui-light', 'theme_light', '#666'), + Theme.new(2, s_('NavigationTheme|Gray'), 'ui-gray', 'theme_gray', '#303030'), + Theme.new(3, s_('NavigationTheme|Light Gray'), 'ui-light-gray', 'theme_light_gray', '#666'), Theme.new(11, s_('NavigationTheme|Dark Mode (alpha)'), 'gl-dark', nil, '#303030') ] end |