-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Added recovery code option to 2fa #23390
Added recovery code option to 2fa #23390
Conversation
@abdulrahuman5196 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
…a-recovery-code
@abdulrahuman5196 Friendly bump |
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
926e52e
to
d5688a2
Compare
…a-recovery-code
d5688a2
to
84f76e9
Compare
Translations are confirmed, and updated code with the latest main branch and solved conflicts. Sorry for force push, I have changed my system and had some problems authenticating with github. It is ready for review now |
Thanks for the confirmation @alitoshmatov . Since this is a critical flow, I would need to through test this and might need some time. Will keep this PR updated |
@alitoshmatov We should clear recovery code data as well here https://github.com/Expensify/App/pull/23390/files#diff-873bd2e06c31caa8e7ca519b38cbd825dad372a68ea5f4e4f00bb27f60b9a9c7R185 |
@MonilBhavsar The recovery code field doesn't have auto-check after entering recovery code. Like we have to press signin after the recovery code has entered in the text input. But both magic code and 2FA code auto hit API after just entering value. |
@alitoshmatov There are multiple useEffects involving clearing/focusing of input based on magicCode and 2FA code status, can we check and include recovery code as well to logics or create useEffects for recovery code in similar way |
Added clearing recovery code there.
I don't think there is a need for handling recovery code in similar cases |
@alitoshmatov Could you kindly add information on why? Anyways i wasn't able to find any visible issues based on the same, but we need to be sure if we don't want to add similar effects. The reason I think is if something is applicable to 2FA code then the same logic should be applicable for recovery codes as well. |
By auto check, you mean auto submit? I think it is only for those numeric inputs. We can leave it here |
Not sure why this exists, but it looks like it was introduced when refactoring to functional components, and these changes were commited under App/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js Lines 119 to 131 in b43c20f
This is one is here since we store App/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js Lines 105 to 110 in b43c20f
And these are for managing focus state of validate code input, not sure why we need this since providing autofocus should work properly, and it seems redundant. App/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js Lines 91 to 103 in b43c20f
To conclude, most of these @abdulrahuman5196 Let me know what you think. |
…a-recovery-code
@abdulrahuman5196 Friendly bump! |
@abdulrahuman5196 I mean, we declare Another way is to declare new state in onyx data and keep track of if user is using recovery code |
I would prefer a onyx state inside account data or something similar like how we have the state to determine 2FA present or not information. @MonilBhavsar what do you think? |
To be honest, a new Onyx data for maintaining state or user method sounds overkill. Would be great if we can do with |
@abdulrahuman5196 Moved state to |
@MonilBhavsar I am not in that much agreement to this approach, but still i agree on the point of onyx being overkill as well. So I am 50-50 on this. Could you kindly give a quick look at the new changes and let me know if this kind of state management is fine? |
That looks good to me. We're taking it one component up to pass the correct |
That's correct |
@abdulrahuman5196 Friendly bump |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-09-16.at.4.36.23.PM.mp4Mobile Web - Chromeaz_recorder_20230916_170026.mp4Mobile Web - SafariScreen.Recording.2023-09-16.at.4.55.39.PM.mp4DesktopScreen.Recording.2023-09-16.at.5.08.43.PM.mp4iOSScreen.Recording.2023-09-16.at.4.44.04.PM.mp4AndroidScreen.Recording.2023-09-16.at.4.47.16.PM.mp4 |
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.
Changes looks good and works well. Reviewers checklist is also complete.
All yours. @MonilBhavsar
🎀 👀 🎀
C+ Reviewed
@alitoshmatov could you please merge main in this branch |
…a-recovery-code
@MonilBhavsar Done |
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.
Looks good and works well! Thank you!!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 1.3.73-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.73-1 🚀
|
🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 1.3.74-0 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.74-3 🚀
|
accessibilityLabel={props.translate('recoveryCodeForm.recoveryCode')} | ||
value={recoveryCode} | ||
onChangeText={(text) => onTextInput(text, 'recoveryCode')} | ||
maxLength={CONST.RECOVERY_CODE_LENGTH} |
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.
This caused a regression here #35947
When we paste a recovery code with spaces at the beginning it will cut out some letters from the end.
Details
User can use recovery code instead of two-factor authentication code by switching to recovery code input
Fixed Issues
$ #22335
PROPOSAL: #22335 (comment)
Tests
Use recovery code
text link is presentOffline tests
Same as tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
web-recovery-code.mov
Mobile Web - Chrome
Screenrecorder-2023-07-22-10-34-18-534.mp4
Mobile Web - Safari
safari-recovery-code.mp4
Desktop
desktop-recovery-code.mov
iOS
ios-recovery-code.mp4
Android
Screenrecorder-2023-07-22-10-35-37-94.mp4