[No QA][ECUK] MFA re-register flow when server returns "registration required"#81747
[No QA][ECUK] MFA re-register flow when server returns "registration required"#81747chuckdries merged 8 commits intomainfrom
Conversation
baa0abb to
92c8d82
Compare
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: baa0abbf3c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| function clearLocalMFAPublicKeyList() { | ||
| Onyx.merge(ONYXKEYS.ACCOUNT, { | ||
| multifactorAuthenticationPublicKeyIDs: null, | ||
| }); |
There was a problem hiding this comment.
Clear MFA keys to undefined, not null
Setting multifactorAuthenticationPublicKeyIDs to null leaves the field defined, so code that treats “ever registered” as !== undefined will still think the user has MFA credentials. For example, SecuritySettingsPage uses account?.multifactorAuthenticationPublicKeyIDs !== undefined to decide whether to show the Revoke option, which means after a REGISTRATION_REQUIRED reset the UI can still show “Revoke” even though the server has no credentials, leading to a misleading action and likely a failed revoke call. Clearing the list by removing the key (or setting to undefined) would keep the “ever registered” semantics aligned with the rest of the app and hide the revoke UI when appropriate.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
We want it to remain defined. The semantics are that undefined means "This user has never registered a public key", which is not true here
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
🚧 @rafecolton has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
src/components/MultifactorAuthentication/Context/usePromptContent.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Rafe Colton <1058475+rafecolton@users.noreply.github.com>
src/components/MultifactorAuthentication/Context/usePromptContent.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Rafe Colton <1058475+rafecolton@users.noreply.github.com>
|
🚧 @chuckdries has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Explanation of Change
When
processis called with theBACKEND.REGISTRATION_REQUIREDerror, we need to delete themultifactorAuthenticationPublicKeyIDsfrom onyx and start the flow over.Fixed Issues
$ #81745
PROPOSAL:
Tests
This one isn't testable under normal circumstances because the commands we use to revoke a user's keys should also clear this state for us in an onyx update, so you have to manipulate the onyx state locally (or somehow force your client to miss the onyx update). Also, this flow is only available on native.
Onyx.get("account").then(console.log)in your console to print the account onyx keymultifactorAuthenticationPublicKeyIDsto a variable, you'll need it laterOnyx.merge("account", { multifactorAuthenticationPublicKeyIDs: [<value you stored earlier>] })in your console to make the client think you're still registeredOffline tests
N/A
QA Steps
N/A - not possible to test without a devtools connection
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
reregister.flow.test.mp4
iOS: Native
reregister.ios.mp4