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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-05 21:10:10 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-05 21:10:10 +0300
commitea4766228b5536c83f1917d6058be913472ffa2d (patch)
tree5ebf5ea0f996be6c6908e6b631b72c33bc13e997 /app/controllers/concerns
parent4b64dc27ae5bac20dec888431c236fef2bfdc449 (diff)
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r--app/controllers/concerns/enforces_two_factor_authentication.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/concerns/enforces_two_factor_authentication.rb b/app/controllers/concerns/enforces_two_factor_authentication.rb
index 6c443611a60..f1dd46648f1 100644
--- a/app/controllers/concerns/enforces_two_factor_authentication.rb
+++ b/app/controllers/concerns/enforces_two_factor_authentication.rb
@@ -12,10 +12,17 @@ module EnforcesTwoFactorAuthentication
included do
before_action :check_two_factor_requirement
- helper_method :two_factor_grace_period_expired?, :two_factor_skippable?
+
+ # to include this in controllers inheriting from `ActionController::Metal`
+ # we need to add this block
+ if respond_to?(:helper_method)
+ helper_method :two_factor_grace_period_expired?, :two_factor_skippable?
+ end
end
def check_two_factor_requirement
+ return unless respond_to?(:current_user)
+
if two_factor_authentication_required? && current_user_requires_two_factor?
redirect_to profile_two_factor_auth_path
end