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

Authentication header xsd validations #5275

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

embarnard
Copy link
Contributor

@embarnard embarnard commented Dec 23, 2024

Link to pivotal/JIRA issue

Is PM acceptance required? (delete one)

  • Yes - don't merge until JIRA issue is accepted!

Reminder: merge main into this branch and get green tests before merging to main

What was done?

  • Added validation to id number on state id form to check for strings between 1-40 characters
  • check for device id to match pattern, if not we send the default
  • Also found a bug where it wouldn't load the follow-up if you selected "Driver license" and reloaded the page or had a validation issue upon submit. You had to re-select the radio button for it to show. check that when you select the "driver's license" option it will still load the followup with validation errors on submit or page reload

How to test?

  • Check if you can submit a id number more than 40 characters
  • select driver license option with validation issues and continue to next page, this change is working if it reloads with the follow up reveals

Screenshots (for visual changes)

Added validation to id field
Screenshot 2024-12-23 at 12 39 55 PM

This is how I reviewed the XML field validations for auth header:
Screenshot 2024-12-23 at 7 12 07 PM

app/javascript/lib/honeycrisp.js Fixed Show fixed Hide fixed
app/javascript/lib/honeycrisp.js Fixed Show fixed Hide fixed
app/javascript/lib/honeycrisp.js Fixed Show fixed Hide fixed
app/javascript/lib/honeycrisp.js Fixed Show fixed Hide fixed
if ($(this).is(':checked')) {
$($(this).attr('data-follow-up')).find('input, select').attr('disabled', false);
$($(this).attr('data-follow-up')).show();
var $input = $(this);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The question-follow-up pattern only assumes that there is one option with the show follow-up option.
So if two or more radio buttons have data-follow-up="#id-details-fields", the final iteration might be one that is not checked—so it will hide #id-details-fields. This change makes it so that we will load the follow-up if any of the options are checked, not just the last one.

Copy link
Member

Choose a reason for hiding this comment

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

I know that @mrotondo and @anisharamnani worked with this code for the Idaho grocery credit - wondering if one of them could give a closer review

Copy link
Contributor

Choose a reason for hiding this comment

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

@mrotondo and i paired on reviewing this.

@embarnard, oof good catch on this bug! this is quite hairy code, so thank you for updating it.

do you mind adding a comment at line 115 just to explain that two questions can refer to the same followup? since this is so tricky, a comment would help.

for future notice, @mrotondo and i spoke about moving this logic to the update command, but that doesn't need to be included in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

definitely! Thank you for reviewing it so thoroughly

if ($(this).is(':checked')) {
$($(this).attr('data-follow-up')).find('input, select').attr('disabled', false);
$($(this).attr('data-follow-up')).show();
var $input = $(this);
Copy link
Member

Choose a reason for hiding this comment

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

I know that @mrotondo and @anisharamnani worked with this code for the Idaho grocery credit - wondering if one of them could give a closer review

app/forms/state_file/state_id_concern.rb Show resolved Hide resolved
@@ -42,7 +42,7 @@ def document
xml.IPv6AddressTxt device_info&.ip_address if device_info&.ip_address&.ipv6?
end
xml.IPTs datetime_type(device_info&.updated_at)
xml.DeviceId device_info&.device_id || 'AB' * 20
xml.DeviceId /^[A-F0-9]{40}$/.match?(device_info&.device_id) ? device_info&.device_id : 'AB' * 20
Copy link
Contributor

Choose a reason for hiding this comment

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

can we write a test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anisharamnani done! thanks for adding that, it actually helped me catch that I hadn't added it to the initial device info block so glad you pointed that out

Copy link
Contributor

@anisharamnani anisharamnani left a comment

Choose a reason for hiding this comment

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

i made two comments--1 to add a test & the other to add a comment to honeycrisp.js. neither of them are blocking. thank you @embarnard!

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.

3 participants