about summary refs log tree commit diff
path: root/app/controllers/settings
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-01-21 13:36:10 -0600
committerDavid Yip <yipdw@member.fsf.org>2018-01-21 13:36:10 -0600
commit1253279febc05c96e4ec875588a0c1c6d723b23c (patch)
treebd4adcddd508239656ff8d37f636af800aa0f742 /app/controllers/settings
parent2c578a01d86ef65d1b0117f6fff32a6b57463dde (diff)
parentcfd2b06821a12f6b4aae427dbb9e6707d1cff9dc (diff)
Merge remote-tracking branch 'origin/master' into merge-upstream
 Conflicts:
	app/controllers/settings/two_factor_authentication/confirmations_controller.rb
Diffstat (limited to 'app/controllers/settings')
-rw-r--r--app/controllers/settings/two_factor_authentication/confirmations_controller.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/settings/two_factor_authentication/confirmations_controller.rb b/app/controllers/settings/two_factor_authentication/confirmations_controller.rb
index f1fa03f0a..8518c61ee 100644
--- a/app/controllers/settings/two_factor_authentication/confirmations_controller.rb
+++ b/app/controllers/settings/two_factor_authentication/confirmations_controller.rb
@@ -3,6 +3,8 @@
 module Settings
   module TwoFactorAuthentication
     class ConfirmationsController < BaseController
+      before_action :ensure_otp_secret
+
       def new
         prepare_two_factor_form
       end
@@ -34,6 +36,10 @@ module Settings
         @provision_url = current_user.otp_provisioning_uri(current_user.email, issuer: Rails.configuration.x.local_domain)
         @qrcode = RQRCode::QRCode.new(@provision_url)
       end
+
+      def ensure_otp_secret
+        redirect_to settings_two_factor_authentication_path unless current_user.otp_secret
+      end
     end
   end
 end