Skip to content

LG-6314: Add Start Over and Cancel links to password confirmation#6350

Merged
aduth merged 4 commits intomainfrom
aduth-lg-6314-start-over-cancel
May 16, 2022
Merged

LG-6314: Add Start Over and Cancel links to password confirmation#6350
aduth merged 4 commits intomainfrom
aduth-lg-6314-start-over-cancel

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented May 13, 2022

Why: For feature parity with the existing screen, a user should have the option to start over or cancel the proofing process.

Testing Instructions:

You will need to set the step as enabled in your local config/application.yml:

development:
  idv_api_enabled_steps: '["password_confirm","personal_key","personal_key_confirm"]'
  1. Navigate to http://localhost:3000
  2. Sign in
  3. Navigate to http://localhost:3000/verify
  4. Complete proofing flow up to password confirmation step
  5. Observe "Start Over" and "Cancel" links at the bottom of the page
  6. Click "Cancel"
  7. Observe you are navigated to the cancel confirmation screen, including ?step=password_confirm in the URL
  8. Click "Go back"
  9. Observe you are returned to the password confirmation screen
  10. Click "Start over"
  11. Observe you are returned to the start of the proofing process

Implementation Notes:

This includes quite a bit of shuffling of components already implemented in document capture, so that they can be reused in both places.

This also implements a new "flow context", whose purpose overlaps with the one being introduced by @nprimak in #6323.

Screenshots:

Before After
localhost_3000_verify_v2_password_confirm localhost_3000_verify_v2

**Why**: For feature parity with the existing screen, a user should have the option to start over or cancel the proofing process.

changelog: Upcoming Features, Identity Verification, Add password confirmation step
@aduth aduth requested a review from a team May 13, 2022 18:25
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM

<input type="hidden" name="_method" value={method} />
<input ref={csrfRef} type="hidden" name="authenticity_token" />
</form>,
document.body,
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need some sort of key to reference these at the document body? so that two ButtonTo's on the same page don't overwrite each other's forms?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we need some sort of key to reference these at the document body? so that two ButtonTo's on the same page don't overwrite each other's forms?

If there were two ButtonTo, each would have and submit their own form, so I don't think they'd conflict with each other.

The markup would look like...

<body>
  <div id="app-root">
    <button></button>
    <button></button>
  </div>
  <form></form>
  <form></form>
</body>

Comment on lines -12 to -13
startOverURL: /** @type {string} */ (''),
cancelURL: /** @type {string} */ (''),
Copy link
Contributor

Choose a reason for hiding this comment

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

awesome that we can clean up the existing flow by using this too

import Button from './button';
import type { ButtonProps } from './button';

interface ButtonToProps extends ButtonProps {
Copy link
Contributor

Choose a reason for hiding this comment

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

would we ever need to add params here that could be posted? or is that the kind of thing we'd add if/when we need it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

would we ever need to add params here that could be posted? or is that the kind of thing we'd add if/when we need it?

Possibly? I liken this to Rails' button_to, which (TIL) supports a params hash for just that purpose. But I heavily subscribe to the school of YAGNI, so I'm not in any hurry to add it.

Copy link
Contributor

Choose a reason for hiding this comment

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

YAGNI 👍

let searchParams: URLSearchParams;

try {
parsedURLOrParams = new URL(urlOrParams);
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason we moved away from the URL class? I'd love to be able to rely on something like that instead of having to build our own

Copy link
Contributor Author

@aduth aduth May 13, 2022

Choose a reason for hiding this comment

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

is there a reason we moved away from the URL class? I'd love to be able to rely on something like that instead of having to build our own

I went through a few iterations of this. The main problem with the URL class is that this function is meant to be quite flexible with its input values (absolute URLs, paths, querystring-only), and it's hard to map each of those to a corresponding return value of the same form using URL.

That being said, I couldn't actually find any existing usage of the querystring parameter input, so we could adjust this to assume that both the input and output would be a full URL.

Copy link
Contributor Author

@aduth aduth May 13, 2022

Choose a reason for hiding this comment

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

Also, to be more specific about why it was changed here: We had been initializing startOverURL and cancelURL with paths. A URL constructor won't parse a path fragment on its own (new URL('/foo') throws). We could adjust this to parse relative to the current URL (e.g. new URL('/foo', window.location.href)), but at that point is when it becomes harder to determine the logic around how to return the expected value (parsedURL.href ? parsedURL.pathname + parsedURL.search ? How do we determine which to use?).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That being said, I couldn't actually find any existing usage of the querystring parameter input, so we could adjust this to assume that both the input and output would be a full URL.

Simplifying supports simplifies the implementation! 0f3f511

aduth added 3 commits May 13, 2022 15:40
To simplify specs, avoid needing to specify them
Simplify supported use-cases to only those we care about, so that we can simplify the implementation

#6350 (comment)
@aduth aduth merged commit cc6364b into main May 16, 2022
@aduth aduth deleted the aduth-lg-6314-start-over-cancel branch May 16, 2022 12:37
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