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:
authorRobert Speicher <rspeicher@gmail.com>2016-02-29 21:58:36 +0300
committerRobert Speicher <rspeicher@gmail.com>2016-02-29 21:58:36 +0300
commitb0ec9529e218ba577404c48453ea1818e28fd382 (patch)
tree71e6a26c9f5ea9bb06a197e39869bc035af98f31
parent3334c3fc7026497fc9da258824795c0ce23a8ffd (diff)
Don't show any "2FA required" message if it's not actually required
Prior, if the user had enabled and then disabled 2FA, they would be shown a "You must enable Two-factor Authentication for your account." message when going back to re-activate it, even if 2FA enforcement was disabled.
-rw-r--r--app/controllers/profiles/two_factor_auths_controller.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/profiles/two_factor_auths_controller.rb
index f3bfede4354..8f83fdd02bc 100644
--- a/app/controllers/profiles/two_factor_auths_controller.rb
+++ b/app/controllers/profiles/two_factor_auths_controller.rb
@@ -12,11 +12,13 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
current_user.save! if current_user.changed?
- if two_factor_grace_period_expired?
- flash.now[:alert] = 'You must enable Two-factor Authentication for your account.'
- else
- grace_period_deadline = current_user.otp_grace_period_started_at + two_factor_grace_period.hours
- flash.now[:alert] = "You must enable Two-factor Authentication for your account before #{l(grace_period_deadline)}."
+ if two_factor_authentication_required?
+ if two_factor_grace_period_expired?
+ flash.now[:alert] = 'You must enable Two-factor Authentication for your account.'
+ else
+ grace_period_deadline = current_user.otp_grace_period_started_at + two_factor_grace_period.hours
+ flash.now[:alert] = "You must enable Two-factor Authentication for your account before #{l(grace_period_deadline)}."
+ end
end
@qr_code = build_qr_code