-
Notifications
You must be signed in to change notification settings - Fork 166
Refactor account personal key reset to use verify flow steps #6453
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
17632f6
Refactor account personal key reset to use verify flow steps
aduth 30bfbc8
Use common props for VerifyFlow specs
aduth f2e03c5
Update personal key regenerate specs as JS-enabled shared examples
aduth 4d94033
Stub GPO for address verification method pre-step setup
aduth 06c31d1
Render static content fallback for no-JS in app root
aduth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { render } from 'react-dom'; | ||
| import { FormSteps } from '@18f/identity-form-steps'; | ||
| import { personalKeyStep, personalKeyConfirmStep } from '@18f/identity-verify-flow'; | ||
|
|
||
| interface AppRootValues { | ||
| personalKey: string; | ||
| } | ||
|
|
||
| interface AppRootElement extends HTMLElement { | ||
| dataset: DOMStringMap & AppRootValues; | ||
| } | ||
|
|
||
| const appRoot = document.getElementById('app-root') as AppRootElement; | ||
| const appForm = document.getElementById('app-form') as HTMLFormElement; | ||
|
|
||
| render( | ||
| <FormSteps | ||
| steps={[personalKeyStep, personalKeyConfirmStep]} | ||
| initialValues={{ personalKey: appRoot.dataset.personalKey }} | ||
| promptOnNavigate={false} | ||
| onComplete={() => appForm.submit()} | ||
| />, | ||
| appRoot, | ||
| ); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| <% title t('titles.personal_key') %> | ||
|
|
||
| <%= render 'shared/personal_key', code: @code, update_path: manage_personal_key_path %> | ||
| <%= form_tag(manage_personal_key_path, method: 'post', id: 'app-form') %> | ||
| <%= content_tag(:div, '', id: 'app-root', data: { personal_key: @code }) do %> | ||
| <%= render 'shared/personal_key', code: @code, update_path: manage_personal_key_path %> | ||
| <% end %> | ||
| <%= javascript_packs_tag_once('verify-personal-key') %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
silly question, how do the values get in to this form before we submit it? it looks like the form lives outside of
appRoot?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.
Not a silly question. The server-side controller doesn't actually care about any submitted values 🙃 The personal key is generated when the page is shown, and the form submission is basically just a redirect.
Page show:
identity-idp/app/controllers/accounts/personal_keys_controller.rb
Lines 13 to 22 in 8cb2802
Page submit:
identity-idp/app/controllers/users/personal_keys_controller.rb
Lines 22 to 25 in 8cb2802
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.
🤦 thanks, I forgot that checking the personal key was all JS before anyways