summaryrefslogtreecommitdiff
path: root/app/controllers/settings/accounts_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/settings/accounts_controller.rb')
-rw-r--r--app/controllers/settings/accounts_controller.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/controllers/settings/accounts_controller.rb b/app/controllers/settings/accounts_controller.rb
new file mode 100644
index 00000000000..a3aa9857444
--- /dev/null
+++ b/app/controllers/settings/accounts_controller.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class Settings::AccountsController < Settings::ApplicationController
+ include AuthHelper
+
+ def show
+ render(locals: show_view_variables)
+ end
+
+ # rubocop: disable CodeReuse/ActiveRecord
+ def unlink
+ provider = params[:provider]
+ identity = current_user.identities.find_by(provider: provider)
+
+ return render_404 unless identity
+
+ if unlink_provider_allowed?(provider)
+ identity.destroy
+ else
+ flash[:alert] = _("You are not allowed to unlink your primary login account")
+ end
+
+ redirect_to settings_account_path
+ end
+ # rubocop: enable CodeReuse/ActiveRecord
+
+ private
+
+ def show_view_variables
+ {}
+ end
+end