about summary refs log tree commit diff
path: root/app/controllers/admin/two_factor_authentications_controller.rb
diff options
context:
space:
mode:
authorKaylee <kaylee@codethat.sucks>2017-05-02 20:07:12 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-05-02 21:07:12 +0200
commit7880671f3527b80de891053beaeae4a8a22c8c58 (patch)
tree43f4cc6ef4f4b90e7d9e4a585f7e6c5c9470ffd0 /app/controllers/admin/two_factor_authentications_controller.rb
parentb5eec3423044f66066d64bd5c9422f40113c543a (diff)
Add option to disable two factor auth in admin accounts panel. (#2584)
* Add option to disable two factor auth in admin accounts panel.
Closes #2578

* Add @mjankowski's suggestions.
* Moves destroy actions behind User#disable_two_factor!
* Adds spec coverage for Admin:TwoFactorAuthenticationsController and User#disable_two_factor!
Diffstat (limited to 'app/controllers/admin/two_factor_authentications_controller.rb')
-rw-r--r--app/controllers/admin/two_factor_authentications_controller.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/admin/two_factor_authentications_controller.rb b/app/controllers/admin/two_factor_authentications_controller.rb
new file mode 100644
index 000000000..69c08f605
--- /dev/null
+++ b/app/controllers/admin/two_factor_authentications_controller.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+module Admin
+  class TwoFactorAuthenticationsController < BaseController
+    before_action :set_user
+
+    def destroy
+      @user.disable_two_factor!
+      redirect_to admin_accounts_path
+    end
+
+    private
+
+    def set_user
+      @user = User.find(params[:user_id])
+    end
+  end
+end