-
Notifications
You must be signed in to change notification settings - Fork 24
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
Remove unnecessary fields from Register an App form BB2-2660 #1203
Remove unnecessary fields from Register an App form BB2-2660 #1203
Conversation
apps/dot_ext/forms.py
Outdated
#Validate choices | ||
if not ( | ||
client_type == "confidential" | ||
and authorization_grant_type == "authorization-code" | ||
): | ||
validate_error = True | ||
#validate_error = True | ||
msg += ( | ||
"Only a confidential client and " | ||
"authorization-code grant type are allowed at this time." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can cut this down through line 113, since you're hard-coding these values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, 95-113 can go, really.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cleaned up and pushed the changes.
apps/dot_ext/forms.py
Outdated
authorization_grant_type = self.fields["authorization_grant_type"] | ||
authorization_grant_type.widget = authorization_grant_type.hidden_widget() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you only need to make the fields optional and cut lines 65 and 66
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I cleaned up and pushed the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and looks like it works well from testing locally, just one more cleanup comment.
apps/dot_ext/forms.py
Outdated
client_type = self.cleaned_data.get("client_type") | ||
authorization_grant_type = self.cleaned_data.get("authorization_grant_type") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem like we need these vars to be set either now that the rest of the logic here is removed.
client_type = self.cleaned_data.get("client_type") | |
authorization_grant_type = self.cleaned_data.get("authorization_grant_type") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! I'd second this. I think this was meant to get ripped out before. I'd say it's good to go otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I lately realized and cleaned up this and committed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
@@ -258,33 +258,6 @@ def test_update_form_edit(self): | |||
form = CustomRegisterApplicationForm(user, passing_app_fields) | |||
self.assertTrue(form.is_valid()) | |||
|
|||
# Test client_type = 'confidential' and authorization_grant_type = 'implicit' not allowed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we should be removing these tests or just reworking what goes on here. It could be a good test to still verify that regardless of what the form data says, we will save confidential
and authorization-code
. Would it make sense for the clean
function to save those values to these fields in the cleaned_data
and then to adjust these tests to instead of expecting an error, to expect that the cleaned_data
shows what we want it to regardless of what was passed in? Part of that question is: should the values be hardcoded in clean
, save
, or both? @loganbertram hoping you can weigh in here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'd leave lines 89-90 in clean() and drop setting the values in save(). I feel like the "cleaning" being done is setting legacy values for fields that don't actually accept other inputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think pulling the tests out makes sense. No way to change these values now and, in the future, if we accept other values, we would need to change this test anyway. I'd be ok with minimal changes too, but this whole testing mechanism doesn't need to exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@loganbertram I tried to move this logic to the clean method but it did not save the fields back to the database.
@jimmyfagan @loganbertram I think we can leave as is for now and do share your thoughts on it?
…s-from-Register-anAppform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for now, I might try to look more into why we couldn't make the change, but it's not worth delaying the functional changes you've made here. Approved!
JIRA Ticket:
BB2-2660
User Story or Bug Summary:
As a Builder, I want to register an app quickly without seeing unnecessary fields, so that I can have a simplified developer experience
Implementation Details
Currently on the "register a new application" form there are two fields that only have one option.
OAuth - Client Type
Authorization Grant Type
There's no need to show these fields anymore since the options can't be changed, and we display the info for them on the success screen after registering an app
What Does This PR Do?
What Should Reviewers Watch For?
If you're reviewing this PR, please check these things, in particular:
What Security Implications Does This PR Have?
Submitters should complete the following questionnaire:
What Needs to Be Merged and Deployed Before this PR?
This PR cannot be either merged or deployed until the following pre-requisite changes have been fully deployed:
Any Migrations?
Submitter Checklist
I have gone through and verified that...:
README
updates and changelog / release notes entries.TODO
and/orFIXME
comments, which include a JIRA ticket ID for any items that require urgent attention.