Skip to content

Commit

Permalink
Catch error and provide message
Browse files Browse the repository at this point in the history
  • Loading branch information
dacook committed Feb 12, 2025
1 parent 2d577e9 commit 9b935be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/controllers/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 9b935be

Please sign in to comment.