Commit a062848
committed
fix: cancel and session-expiry now correctly return to the password screen
Root cause was two-layered:
1. resetToPasswordFlow() reset authFlow to FLOW.PASSWORD but also cleared
user_name/user_pic/user_fullname/user_verified in the same setState call.
isPasswordFlow's render condition requires user_verified === true, so
wiping it forced the render logic to showDefaultFlow (the email screen)
regardless of authFlow being correct.
2. That alone wasn't sufficient: since the password step now submits as a
native form POST (see the earlier native-submit fix), the mfa_required
transition is a full page reload, not a client-side setState - the React
app remounts from scratch and only recovers state the backend flashed to
session. issueChallenge() (EmailOTPMFAChallengeStrategy/AbstractMFA
ChallengeStrategy) only returns otp_length/otp_lifetime, so
challengeRequired()'s session flash never carried username/user_fullname/
user_pic/user_verified in the first place - user_verified was already
false the moment the 2FA screen first rendered, before Cancel was ever
clicked. Fix #1 alone had nothing to preserve.
Fix: postLogin()'s mfa_required branch now merges the same identity fields
into the challengeRequired() payload that the AuthenticationException
errorLogin() branch already flashes (same fields, same getters: username,
user_fullname, user_pic, user_verified, user_is_active) - restoring the
identity chip on the 2FA screen and giving resetToPasswordFlow() correct
state to preserve. resetToPasswordFlow() no longer clears user_name/user_pic/
user_fullname/user_verified.
Verified live: 2FA screen now shows the identity chip from first render:
Cancel from the 2FA screen now returns directly to the password screen with
the same user still identified, instead of resetting to the email-entry
screen. tests/TwoFactorLoginFlowTest.php passes in full (31 tests, 120
assertions) - unaffected, since no test asserted the previously-missing
identity fields.1 parent f67f5b1 commit a062848
2 files changed
Lines changed: 15 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
534 | 549 | | |
535 | 550 | | |
536 | 551 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
299 | 298 | | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | 299 | | |
304 | 300 | | |
305 | 301 | | |
| |||
0 commit comments