Link to OIDC settings from error message

The colour of the link is really bad though.
This commit is contained in:
Maikel Linke
2025-02-06 17:11:37 +11:00
parent bb503e12a3
commit ffe4084b7f
3 changed files with 10 additions and 5 deletions

View File

@@ -33,8 +33,12 @@ module Admin
flash[:error] = e.message
redirect_to admin_product_import_path
rescue Rack::OAuth2::Client::Error
flash[:error] = t(".connection_invalid")
redirect_to admin_oidc_settings_path
oidc_settings_link = helpers.link_to(
t('spree.admin.tab.oidc_settings'),
admin_oidc_settings_path
)
flash[:error] = t(".connection_invalid_html", oidc_settings_link:)
redirect_to admin_product_import_path
end
def import

View File

@@ -847,9 +847,9 @@ en:
map: Map
dfc_product_imports:
connection_invalid: |
connection_invalid_html: |
Connecting with your OIDC account failed.
Please refresh your OIDC connection.
Please refresh your OIDC connection at: %{oidc_settings_link}
index:
title: "DFC product catalog"
catalog_url: "%{count} products to be imported from: %{catalog_url}"

View File

@@ -132,7 +132,8 @@ RSpec.describe "DFC Product Import" do
click_button "Preview"
expect(page).to have_content "OIDC Settings"
expect(page).to have_content "Product Import"
expect(page).to have_content "Connecting with your OIDC account failed."
expect(page).to have_content "Please refresh your OIDC connection at: OIDC Settings"
end
end