diff --git a/app/controllers/users/settings/account/connected_accounts_controller.rb b/app/controllers/users/settings/account/connected_accounts_controller.rb new file mode 100644 index 000000000..2edee3954 --- /dev/null +++ b/app/controllers/users/settings/account/connected_accounts_controller.rb @@ -0,0 +1,19 @@ +module Users + module Settings + module Account + class ConnectedAccountsController < ApplicationController + layout 'fluid' + + def index + @linked_accounts = current_user.user_identities.pluck(:provider) + end + + def destroy + current_user.user_identities.where(provider: params.require(:provider)).take&.destroy! + @linked_accounts = current_user.user_identities.pluck(:provider) + render :index + end + end + end + end +end diff --git a/app/helpers/left_menu_bar_helper.rb b/app/helpers/left_menu_bar_helper.rb index 13c0260d8..536ef7391 100644 --- a/app/helpers/left_menu_bar_helper.rb +++ b/app/helpers/left_menu_bar_helper.rb @@ -18,7 +18,7 @@ module LeftMenuBarHelper end def settings_are_selected? - controller_name.in? %(registrations preferences addons teams) + controller_name.in? %(registrations preferences addons teams connected_accounts) end def activities_are_selected? diff --git a/app/helpers/user_settings_helper.rb b/app/helpers/user_settings_helper.rb index 448ef9b63..3332564e0 100644 --- a/app/helpers/user_settings_helper.rb +++ b/app/helpers/user_settings_helper.rb @@ -2,7 +2,8 @@ module UserSettingsHelper def on_settings_account_page? controller_name == 'registrations' && action_name == 'edit' || controller_name == 'preferences' && action_name == 'index' || - controller_name == 'addons' && action_name == 'index' + controller_name == 'addons' && action_name == 'index' || + controller_name == 'connected_accounts' end def on_settings_account_profile_page? @@ -21,4 +22,8 @@ module UserSettingsHelper controller_name.in?(%w(teams audits)) && action_name.in?(%w(index new create show audits_index)) end + + def on_settings_account_connected_accounts_page? + controller_name == 'connected_accounts' + end end diff --git a/app/views/users/settings/_sidebar.html.erb b/app/views/users/settings/_sidebar.html.erb index a68b5c6c9..82530afef 100644 --- a/app/views/users/settings/_sidebar.html.erb +++ b/app/views/users/settings/_sidebar.html.erb @@ -56,6 +56,20 @@ <% end %> + +
<%= t('users.settings.account.connected_accounts.azure_ad.connect_hint') %>
+