WEB-1032: Fix 2FA email OTP not working in login#3732
Conversation
|
Note
|
| Layer / File(s) | Summary |
|---|---|
Async state rendering src/app/login/two-factor-authentication/two-factor-authentication.component.ts |
Injects ChangeDetectorRef and marks the component for checking after asynchronous two-factor authentication state changes. |
Estimated code review effort: 1 (Trivial) | ~2 minutes
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title clearly and concisely describes the main fix: 2FA email OTP login flow not working. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
The two-factor-authentication component uses ChangeDetectionStrategy.OnPush but never calls markForCheck() after its asynchronous state updates, so the view was never refreshed: - Delivery methods loaded via getDeliveryMethods().subscribe() were never rendered, so the login screen showed "Please select a delivery method:" with no radio options and a permanently-disabled "Request OTP" button. - otpRequested / tokenValidityTime set after requestOTP() never revealed the OTP entry field. - loading / resendOTPLoading spinner states were also not reflected. Inject ChangeDetectorRef and call markForCheck() after each async state mutation (delivery-method load, requestOTP, validateOTP, resendOTP). Verified end-to-end against the 2fa.mifos.community backend and a local Fineract instance: the email delivery method now renders, the Request OTP button enables on selection, and the OTP entry field appears.
a0ff4df to
afc8f14
Compare
Description
TwoFactorAuthenticationComponent uses
ChangeDetectionStrategy.OnPushbut never callsmarkForCheck()after its asynchronous state updates. Under OnPush the view only refreshes when explicitly marked dirty, but every state change in this component happens inside async RxJS callbacks:getDeliveryMethods().subscribe()were never rendered, so the login screen showedPlease select a delivery methodwith no radio options and a permanently-disabledRequest OTPbutton.Inject
ChangeDetectorRefand callmarkForCheck()after each async state mutation (delivery-method load, requestOTP, validateOTP, resendOTP).Verified end-to-end against the 2fa.mifos.community backend and a local Fineract instance: the email delivery method now renders, the Request OTP button enables on selection, and the OTP entry field appears.
Related issues and discussion
#WEB-1032
Screenshots, if any
Before

After

Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
If you have multiple commits please combine them into one commit by squashing them.
Read and understood the contribution guidelines at
web-app/.github/CONTRIBUTING.md.Summary by CodeRabbit