Catch error and provide message

This commit is contained in:
David Cook
2025-02-03 13:33:42 +11:00
parent 2d577e9e46
commit 9b935be4d6
2 changed files with 4 additions and 0 deletions

View File

@@ -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

View File

@@ -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"