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

Fix API key generation when user edits are disabled #2004

Merged
merged 7 commits into from
Oct 25, 2024

Conversation

replaceafill
Copy link
Member

When the ALLOW_USER_EDITS setting of the Dashboard is set to False the user profile view shows most fields as read-only but allows the user to regenerate their API key.

However, submission handling of the form is currently broken and the API key is always regenerated when the Save button is clicked ignoring the state of the Regenerate API key checkbox.

This also extends test coverage of the views of the accounts and administration packages.

This test submits the user profile form leaving the "Regenerate API
key" field unchecked.

The test fails because the API key is always updated on POST
submission when the ALLOW_USER_EDITS setting is False.
This updates the ApiKeyForm to use boolean values instead of
characters and the profile view to use the cleaned_data attribute of
the form to check if API key regeneration was requested.
Copy link
Contributor

@Dhwaniartefact Dhwaniartefact left a comment

Choose a reason for hiding this comment

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

lgtm!

@replaceafill replaceafill merged commit 6a9f0e9 into qa/1.x Oct 25, 2024
26 checks passed
@replaceafill replaceafill deleted the dev/fix-user-api-key-generation branch October 25, 2024 12:59
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.

2 participants