diff options
Diffstat (limited to 'app/controllers/admin/sessions_controller.rb')
-rw-r--r-- | app/controllers/admin/sessions_controller.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/admin/sessions_controller.rb b/app/controllers/admin/sessions_controller.rb index 0c0bbaf4d93..9c378f4c883 100644 --- a/app/controllers/admin/sessions_controller.rb +++ b/app/controllers/admin/sessions_controller.rb @@ -1,12 +1,14 @@ # frozen_string_literal: true class Admin::SessionsController < ApplicationController - include Authenticates2FAForAdminMode + include AuthenticatesWithTwoFactorForAdminMode include InternalRedirect include RendersLdapServers before_action :user_is_admin! + feature_category :authentication_and_authorization + def new if current_user_mode.admin_mode? redirect_to redirect_path, notice: _('Admin mode already enabled') @@ -65,7 +67,10 @@ class Admin::SessionsController < ApplicationController end def valid_otp_attempt?(user) - valid_otp_attempt = user.validate_and_consume_otp!(user_params[:otp_attempt]) + otp_validation_result = + ::Users::ValidateOtpService.new(user).execute(user_params[:otp_attempt]) + valid_otp_attempt = otp_validation_result[:status] == :success + return valid_otp_attempt if Gitlab::Database.read_only? valid_otp_attempt || user.invalidate_otp_backup_code!(user_params[:otp_attempt]) |