Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/profiles')
-rw-r--r--app/controllers/profiles/chat_names_controller.rb2
-rw-r--r--app/controllers/profiles/notifications_controller.rb2
-rw-r--r--app/controllers/profiles/preferences_controller.rb2
-rw-r--r--app/controllers/profiles/two_factor_auths_controller.rb24
4 files changed, 18 insertions, 12 deletions
diff --git a/app/controllers/profiles/chat_names_controller.rb b/app/controllers/profiles/chat_names_controller.rb
index 8cfec247b7a..ae757c30d1c 100644
--- a/app/controllers/profiles/chat_names_controller.rb
+++ b/app/controllers/profiles/chat_names_controller.rb
@@ -4,7 +4,7 @@ class Profiles::ChatNamesController < Profiles::ApplicationController
before_action :chat_name_token, only: [:new]
before_action :chat_name_params, only: [:new, :create, :deny]
- feature_category :users
+ feature_category :integrations
def index
@chat_names = current_user.chat_names
diff --git a/app/controllers/profiles/notifications_controller.rb b/app/controllers/profiles/notifications_controller.rb
index 6ef0ed6d365..ccfd360a781 100644
--- a/app/controllers/profiles/notifications_controller.rb
+++ b/app/controllers/profiles/notifications_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class Profiles::NotificationsController < Profiles::ApplicationController
- feature_category :users
+ feature_category :team_planning
def show
@user = current_user
diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb
index adecb56ea38..820b6520f6c 100644
--- a/app/controllers/profiles/preferences_controller.rb
+++ b/app/controllers/profiles/preferences_controller.rb
@@ -36,6 +36,8 @@ class Profiles::PreferencesController < Profiles::ApplicationController
def preferences_param_names
[
:color_scheme_id,
+ :diffs_deletion_color,
+ :diffs_addition_color,
:layout,
:dashboard,
:project_view,
diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/profiles/two_factor_auths_controller.rb
index 77fae34e2d2..48b0d313d3c 100644
--- a/app/controllers/profiles/two_factor_auths_controller.rb
+++ b/app/controllers/profiles/two_factor_auths_controller.rb
@@ -4,6 +4,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
skip_before_action :check_two_factor_requirement
before_action :ensure_verified_primary_email, only: [:show, :create]
before_action :validate_current_password, only: [:create, :codes, :destroy], if: :current_password_required?
+ before_action :update_current_user_otp!, only: [:show]
helper_method :current_password_required?
@@ -14,16 +15,6 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
feature_category :authentication_and_authorization
def show
- unless current_user.two_factor_enabled?
- current_user.otp_secret = User.generate_otp_secret(32)
- end
-
- unless current_user.otp_grace_period_started_at && two_factor_grace_period
- current_user.otp_grace_period_started_at = Time.current
- end
-
- Users::UpdateService.new(current_user, user: current_user).execute!
-
if two_factor_authentication_required? && !current_user.two_factor_enabled?
two_factor_authentication_reason(
global: lambda do
@@ -68,6 +59,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
else
@error = { message: _('Invalid pin code.') }
@qr_code = build_qr_code
+ @account_string = account_string
if Feature.enabled?(:webauthn, default_enabled: :yaml)
setup_webauthn_registration
@@ -138,6 +130,18 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
private
+ def update_current_user_otp!
+ if current_user.needs_new_otp_secret?
+ current_user.update_otp_secret!
+ end
+
+ unless current_user.otp_grace_period_started_at && two_factor_grace_period
+ current_user.otp_grace_period_started_at = Time.current
+ end
+
+ Users::UpdateService.new(current_user, user: current_user).execute!
+ end
+
def validate_current_password
return if current_user.valid_password?(params[:current_password])