about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-01-21 18:00:08 -0600
committerGitHub <noreply@github.com>2018-01-21 18:00:08 -0600
commita90d0419d97db50cca034b9d30969f3d161a69b1 (patch)
tree86c6a4182cda85171caf2f5c1553c054ed7b7e1f /app/controllers
parent81b78fac542be867eedc7a0310e29de30b382770 (diff)
parent48d79007f616ba03f663d29536927f6ab14e4b53 (diff)
Merge pull request #343 from glitch-soc/merge-upstream-20180121
Merge upstream
Diffstat (limited to 'app/controllers')
-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