diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-26 15:07:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-26 15:07:48 +0300 |
commit | ef31adeb0fb9a02b2c6a4529ec4e38d7082a4b2b (patch) | |
tree | f0ee2b8bdffd7f91ad0b31388562c90825179585 /app/controllers/admin | |
parent | 7e019504f5ac6decde690565857238e7e59aa034 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/admin')
-rw-r--r-- | app/controllers/admin/concerns/authenticates_2fa_for_admin_mode.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/sessions_controller.rb | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/admin/concerns/authenticates_2fa_for_admin_mode.rb b/app/controllers/admin/concerns/authenticates_2fa_for_admin_mode.rb index c6fd1d55e51..6014ed0dd13 100644 --- a/app/controllers/admin/concerns/authenticates_2fa_for_admin_mode.rb +++ b/app/controllers/admin/concerns/authenticates_2fa_for_admin_mode.rb @@ -37,7 +37,7 @@ module Authenticates2FAForAdminMode # Remove any lingering user data from login session.delete(:otp_user_id) - user.save! + user.save! unless Gitlab::Database.read_only? # The admin user has successfully passed 2fa, enable admin mode ignoring password enable_admin_mode diff --git a/app/controllers/admin/sessions_controller.rb b/app/controllers/admin/sessions_controller.rb index 841ad46b47e..1dc1cd5fb82 100644 --- a/app/controllers/admin/sessions_controller.rb +++ b/app/controllers/admin/sessions_controller.rb @@ -64,7 +64,9 @@ class Admin::SessionsController < ApplicationController end def valid_otp_attempt?(user) - user.validate_and_consume_otp!(user_params[:otp_attempt]) || - user.invalidate_otp_backup_code!(user_params[:otp_attempt]) + valid_otp_attempt = user.validate_and_consume_otp!(user_params[:otp_attempt]) + return valid_otp_attempt if Gitlab::Database.read_only? + + valid_otp_attempt || user.invalidate_otp_backup_code!(user_params[:otp_attempt]) end end |