diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index c483d6f4b76..d55c5600e21 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -4,6 +4,9 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController def openid_connect OidcAccount.link(spree_current_user, request.env["omniauth.auth"]) + redirect_to admin_oidc_settings_path + rescue ActiveRecord::RecordNotUnique + flash[:error] = t("devise.oidc.record_not_unique", uid: request.env["omniauth.auth"].uid) redirect_to admin_oidc_settings_path end diff --git a/config/locales/en.yml b/config/locales/en.yml index 946f9c24d71..6e5d5f6f3d1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -321,6 +321,7 @@ en: send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes." oidc: failure: "Could not sign in: %{error}" + record_not_unique: "%{uid} is already associated with another account" home_page_alert_html: "Home page alert HTML" hub_signup_case_studies_html: "Hub signup case studies HTML" hub_signup_detail_html: "Hub signup detail HTML"