feat(sms): Set up flow to add recovery phone from Settings#18276
feat(sms): Set up flow to add recovery phone from Settings#18276vpomerleau merged 1 commit intomainfrom
Conversation
| } | ||
|
|
||
| const code = await this.otpCode.generateCode(); | ||
| await this.recoveryPhoneManager.storeUnconfirmed( |
There was a problem hiding this comment.
Not sure why but I wasn't seeing this show up in Redis, it looked like there was an entry but nothing to expand/look at. When I'm done with this PR I'll circle back and see if it works removing the change in this file.
vpomerleau
left a comment
There was a problem hiding this comment.
Left some comments from first pass, will have another look once rebased on main!
| nullable: true, | ||
| description: 'The registered recovery phone number', | ||
| description: | ||
| 'The registered recovery phone number. If the user does not have a verified session, this field will return the last 4 digits of the phone number with a mask on the rest.', |
There was a problem hiding this comment.
Does it return with mask, or just return the last 4 digits?
There was a problem hiding this comment.
Currently it returns with a mask, but I think it makes sense for it to return with only the last 4 digits. I'll file one issue for the Twilio national_format bit + this since they're related.
| /> | ||
| </AppContext.Provider> | ||
| ); | ||
| // Recovery phone not shown since `available` is based on region and recovery codes |
There was a problem hiding this comment.
Should these stories be re-enabled or deleted?
There was a problem hiding this comment.
They're all there I believe, they were just refactored to use createSubject (and I added a couple new ones).
| ).toContain(MOCK_MASKED_PHONE_NUMBER); | ||
| expect( | ||
| screen.queryByTestId('backup-authentication-codes-sub-row') | ||
| ).toBeInTheDocument(); |
There was a problem hiding this comment.
Check that recovery phone delete button is unavailable, or tested in sub-component?
| ).toContain(MOCK_MASKED_PHONE_NUMBER); | ||
| expect( | ||
| screen.getByTestId('backup-authentication-codes-sub-row').textContent | ||
| ).toContain('3'); |
There was a problem hiding this comment.
test that delete available for phone number?
| config.featureFlags?.enableAdding2FABackupPhone === true && | ||
| (recoveryPhone.available === true || recoveryPhone.exists === true) |
There was a problem hiding this comment.
| config.featureFlags?.enableAdding2FABackupPhone === true && | |
| (recoveryPhone.available === true || recoveryPhone.exists === true) | |
| (config.featureFlags?.enableAdding2FABackupPhone === true && | |
| recoveryPhone.available === true) || recoveryPhone.exists === true |
There was a problem hiding this comment.
I think the row should always be shown if a user has added a recovery phone, regardless of whether adding or using a phone is enabled. They should have the option of removing the phone number from their account even if we've had to disable actually using the feature.
There was a problem hiding this comment.
Which makes me think that the "remove phone" route option should depend on having a phone configured and not on the feature flags... hm...
There was a problem hiding this comment.
Oh yeah, good catch. When I first wrote this logic, I don't think I realized this would hide the remove option for users if the feature flag was off.
Which makes me think that the "remove phone" route option should depend on having a phone configured and not on the feature flags... hm...
I guess both? The "manage" flag should be on and the user should have a phone number.
868adab to
5e7431d
Compare
vpomerleau
left a comment
There was a problem hiding this comment.
Thanks for the updates! This is looking great 🚀 Approved pending CI passes and your final run of manual testing 🤘
| // Just retry adding the number and another code will send. Note that more than | ||
| // one code can be valid at the same time if the user clicks “resend code” to | ||
| // account for SMS transmission delay. | ||
| // try/catch is in the component that calls this function |
There was a problem hiding this comment.
Noting that @vbudhram recommends invalidating the previous code when a new one is sent one. There's a thread up for discussion in the Slack channel for this project
There was a problem hiding this comment.
Was the try-catch comment meant to stay in, or a self-review note?
There was a problem hiding this comment.
Sure - sounds like we have a separate issue filed for that, I can link it here since I need another push anyway. 👍
I left that in because at first I wrapped this in the try/catch since usually our account.whatever methods have a try/catch, and then realized we didn't need it. Can remove if you want though.
| navigate(`${SETTINGS_PATH}/recovery_phone/setup`); | ||
| }} | ||
| onDeleteClick={() => { | ||
| navigate(`${SETTINGS_PATH}/recovery_phone/remove`); |
| @@ -1,3 +1,4 @@ | |||
| import { existsSync } from 'fs'; | |||
There was a problem hiding this comment.
unused import causing build failure on CI
There was a problem hiding this comment.
Ahhh dumb auto import, thanks.
|
Looks like |
|
@vbudhram ahh thank you, there was a big ol' merge conflict there and I resolved with my changes and totally forgot to add yours back in! |
Because: * We want users to be able to add a recovery phone This commit: * Enables the "add" page if the feature flag is on and availability from GQL is true * Returns 'availability' with other recovery phone info in the GQL resolver * Displays recovery phone info in recovery phone row, * Hides 'change' and 'delete' buttons if user doesn't have a recovery phone set up, displays SIM swap link only if user doesn't have a recovery phone closes FXA-10370
Because:
This commit:
closes FXA-10370
You will need these env vars set:
The magic number
4159929960works for this flow.