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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable api key checkbox does not remove api key #6017

Merged
merged 3 commits into from Apr 25, 2024

Conversation

DanRibbens
Copy link
Contributor

@DanRibbens DanRibbens commented Apr 24, 2024

Description

Fixes #5742

The checkbox to disable API Keys did not clear the apiKey from form state. The request on save after unchecking still had it.
image

This change makes it so that apiKey is sent to the API as null so that it can be properly saved without a key.
The e2e test associated with the feature was passing because it didn't properly send the apiKey to test against in the /me route 馃う.

I've also changed the API Key index hook so that local operations passing data respect the request moving forward. The following scenarios will result in a usable API Key:

  • `data: { apiKey: '0987654321 }'
  • data: { apiKey: '0987654321', enableAPIKey: true }

Updates made with the following will prevent the API key auth strategy for the user:

  • `data: { apiKey: '0987654321', enableAPIKey: false }
  • `data: { apiKey: '0987654321', enableAPIKey: null }
  • data: { enableAPIKey: false }
  • data: { enableAPIKey: null }
  • data: { apiKey: false }
  • data: { apiKey: null }

End result:
image

  • I have read and understand the CONTRIBUTING.md document in this repository.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have added tests that prove my fix is effective or that my feature works
  • Existing test suite passes locally with my changes

@jmikrut jmikrut merged commit 0ffdcc6 into main Apr 25, 2024
33 checks passed
@jmikrut jmikrut deleted the fix/disable-api-key branch April 25, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API key remains in the DB and is not actually disabled
2 participants