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 paste for personal key confirmation (IdV app) #6443

Merged
merged 2 commits into from
Jun 3, 2022

Conversation

aduth
Copy link
Member

@aduth aduth commented Jun 2, 2022

Why: Because the primary user interaction we expect here is for the user to paste the personal key after clicking the "Copy" button on the personal key display page.

Testing Instructions:

  1. Go to http://localhost:3000
  2. Sign in
  3. Go to http://localhost:3000/verify
  4. Complete proofing flow up to personal key screen
  5. Copy personal key
  6. Click Continue
  7. Paste personal key by some other means than Cmd + V, e.g. right-click or Mac "Edit" dropdown

Before: Content is not pasted
After: Content is pasted

Implementation Notes:

This may be a bug in Cleave.js, where after the input value is changed, it tries to format the value, and expects to use the last input value ([1][2]). This value is initially undefined and only set in response to keydown events, so if the user were to type regularly in the field, or use key combinations like Cmd + V, the value would be set ([3]). When directly pasting, it would be undefined, resulting in an error trying to slice an undefined value.

The resolution proposed here is to force Cleave.js to assign a string value for lastInputValue when initialized, via its internal updateValueState method ([4]).

Edit: Upstream report: nosir/cleave.js#691

**Why**: Because the primary user interaction we expect here is for the user to paste the personal key after clicking the "Copy" button on the personal key display page.

changelog: Upcoming Features, Identity Verification, Add personal key step screen
@aduth aduth requested a review from a team June 2, 2022 19:16
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, love covering with a capybara spec too

spec/support/shared_examples_for_personal_keys.rb Outdated Show resolved Hide resolved
@aduth aduth merged commit 322a5c3 into main Jun 3, 2022
@aduth aduth deleted the aduth-idv-api-personal-key-paste branch June 3, 2022 12:40
@aduth aduth mentioned this pull request Jun 7, 2022
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