diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-05 21:10:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-05 21:10:10 +0300 |
commit | ea4766228b5536c83f1917d6058be913472ffa2d (patch) | |
tree | 5ebf5ea0f996be6c6908e6b631b72c33bc13e997 /app/controllers/concerns | |
parent | 4b64dc27ae5bac20dec888431c236fef2bfdc449 (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.rb | 9 |
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 |