Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch error and provide message #13115

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dacook
Copy link
Member

@dacook dacook commented Feb 3, 2025

What? Why?

What should we test?

  • Ensure an OFN user account is connected with Keycloak
  • Log into a different OFN user account
  • Try connecting with same Keycloak account.
  • An error message should appear, instead of server error.

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • User facing changes
  • API changes (V0, V1, DFC or Webhook)
  • Technical changes only
  • Feature toggled

The title of the pull request will be included in the release notes.

Dependencies

Documentation updates

@dacook dacook requested a review from mkllnk February 3, 2025 02:34
@dacook
Copy link
Member Author

dacook commented Feb 3, 2025

@mkllnk , can you please review the error above, and let me know if I'm on the right track?

If so, I'll go ahead and add a spec (I think a spec request would be sufficient)

Comment on lines +8 to 13
rescue ActiveRecord::RecordNotUnique
flash[:error] = t("devise.oidc.record_not_unique", uid: request.env["omniauth.auth"].uid)
redirect_to admin_oidc_settings_path
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks right.

@dacook dacook force-pushed the oidc-record-not-unique branch from faa7abd to 61d0df1 Compare February 12, 2025 05:09
Oh, and a transaction block. Because the controller after hooks tried to update the DB which resulted in
  PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block

Even for a small rescue statement, it's worth adding a spec. You never know what might not be working!
@dacook dacook force-pushed the oidc-record-not-unique branch from 61d0df1 to f6f1a00 Compare February 12, 2025 05:11
@dacook dacook added the technical changes only These pull requests do not contain user facing changes and are grouped in release notes label Feb 12, 2025
@dacook dacook marked this pull request as ready for review February 12, 2025 05:13
@dacook dacook requested a review from mkllnk February 12, 2025 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical changes only These pull requests do not contain user facing changes and are grouped in release notes
Projects
Status: Code review 🔎
Development

Successfully merging this pull request may close these issues.

ActiveRecord::RecordNotUnique in omniauth_callbacks#openid_connect
2 participants