diff --git a/app/controllers/users/settings/account/connected_accounts_controller.rb b/app/controllers/users/settings/account/connected_accounts_controller.rb index 8f3c981de..d30a2579d 100644 --- a/app/controllers/users/settings/account/connected_accounts_controller.rb +++ b/app/controllers/users/settings/account/connected_accounts_controller.rb @@ -9,20 +9,15 @@ module Users end def destroy - settings = ApplicationSettings.instance - if settings.values['azure_ad_apps']&.find { |v| v['provider_name'] == params[:provider] } - provider = params[:provider] - else - flash[:error] = t('users.settings.account.connected_accounts.errors.not_found') + user_identity = current_user.user_identities.find_by(provider: params[:provider]) + if user_identity.blank? + flash.now[:error] = t('users.settings.account.connected_accounts.errors.not_found') return end - ActiveRecord::Base.transaction do - __send__("#{provider}_pre_destroy".to_sym) if respond_to?("#{provider}_pre_destroy".to_sym, true) - current_user.user_identities.where(provider: provider).take&.destroy! - end - flash[:success] = t('users.settings.account.connected_accounts.unlink_success') + user_identity.destroy! + flash.now[:success] = t('users.settings.account.connected_accounts.unlink_success') rescue StandardError - flash[:error] ||= t('users.settings.account.connected_accounts.errors.generic') + flash.now[:error] ||= t('users.settings.account.connected_accounts.errors.generic') ensure @linked_accounts = current_user.user_identities.pluck(:provider) render :index diff --git a/app/views/users/settings/account/connected_accounts/_okta.html.erb b/app/views/users/settings/account/connected_accounts/_okta.html.erb new file mode 100644 index 000000000..8e87c054b --- /dev/null +++ b/app/views/users/settings/account/connected_accounts/_okta.html.erb @@ -0,0 +1,24 @@ +
<%= t('users.settings.account.connected_accounts.okta.connect_hint') %>
+