Commit 86412e0
authored
fix: social login authentication state before rehydrate cp-13.11.0 (#38170)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
Fixed social login authentication-state validation in rehydration flow.
[](https://codespaces.new/MetaMask/metamask-extension/pull/38170?quickstart=1)
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: fixed social login authentication validation in
rehydrate.
## **Related issues**
Fixes: #38172
## **Manual testing steps**
1. Click on create new wallet and login with existing social login
account
2. After completing social login, close the browser at the unlock page
3. Open the browser and wallet again.
4. You should be redirect back to the welcome page
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Refactors social login onboarding to async-validate auth before
redirects, adjusts first-time flow checks, and simplifies Account
Exist/Not Found to navigate without mutating flow state; updates tests
accordingly.
>
> - **Onboarding Welcome
(`ui/pages/onboarding-flow/welcome/welcome.js`)**
> - Replace `getIsSocialLoginUserAuthenticated` with
`getIsSocialLoginFlow` and async auth check via
`getIsSeedlessOnboardingUserAuthenticated` before redirecting.
> - Guard redirects with `isMounted` flag; handle social create vs
import navigation accordingly.
> - Defer setting `firstTimeFlowType` for social flows until after OAuth
result (set to `socialCreate` for new users, `socialImport` for
existing).
> - **Account pages**
> - `account-exist.tsx` and `account-not-found.tsx`:
> - Remove `setFirstTimeFlowType` dispatches; rely on navigation only.
> - In `useEffect`, invert/clarify conditions to show page only for the
matching `FirstTimeFlowType` (`socialImport` for exist, `socialCreate`
for not-found); otherwise redirect to `ONBOARDING_WELCOME_ROUTE`.
> - Add "use different login method" handler to reset onboarding state
and navigate to welcome.
> - **Tests**
> - Update tests to remove expectations around `setFirstTimeFlowType`
and reflect new routing conditions and reset behavior in both account
pages.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
97b3b51. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent e7f54a4 commit 86412e0
File tree
5 files changed
+52
-48
lines changed- ui/pages/onboarding-flow
- account-exist
- account-not-found
- welcome
5 files changed
+52
-48
lines changedLines changed: 2 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 49 | | |
54 | 50 | | |
55 | 51 | | |
| |||
58 | 54 | | |
59 | 55 | | |
60 | 56 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | 57 | | |
65 | 58 | | |
66 | 59 | | |
67 | | - | |
| 60 | + | |
68 | 61 | | |
69 | 62 | | |
70 | 63 | | |
71 | 64 | | |
72 | | - | |
| 65 | + | |
73 | 66 | | |
74 | 67 | | |
75 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| |||
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
83 | | - | |
84 | 82 | | |
85 | 83 | | |
86 | 84 | | |
87 | 85 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 86 | + | |
92 | 87 | | |
93 | 88 | | |
94 | 89 | | |
| |||
99 | 94 | | |
100 | 95 | | |
101 | 96 | | |
| 97 | + | |
| 98 | + | |
102 | 99 | | |
103 | 100 | | |
104 | | - | |
| 101 | + | |
105 | 102 | | |
106 | 103 | | |
107 | 104 | | |
| |||
Lines changed: 2 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 56 | | |
61 | 57 | | |
62 | 58 | | |
| |||
66 | 62 | | |
67 | 63 | | |
68 | 64 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | 65 | | |
73 | 66 | | |
74 | 67 | | |
| |||
78 | 71 | | |
79 | 72 | | |
80 | 73 | | |
81 | | - | |
| 74 | + | |
82 | 75 | | |
83 | 76 | | |
84 | 77 | | |
85 | 78 | | |
86 | | - | |
| 79 | + | |
87 | 80 | | |
88 | 81 | | |
89 | 82 | | |
| |||
Lines changed: 4 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| |||
74 | 73 | | |
75 | 74 | | |
76 | 75 | | |
77 | | - | |
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 80 | + | |
87 | 81 | | |
88 | 82 | | |
89 | 83 | | |
| |||
93 | 87 | | |
94 | 88 | | |
95 | 89 | | |
| 90 | + | |
| 91 | + | |
96 | 92 | | |
97 | 93 | | |
98 | | - | |
| 94 | + | |
99 | 95 | | |
100 | 96 | | |
101 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 76 | + | |
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
| |||
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
97 | 108 | | |
98 | 109 | | |
99 | 110 | | |
| 111 | + | |
| 112 | + | |
100 | 113 | | |
101 | 114 | | |
102 | 115 | | |
| |||
117 | 130 | | |
118 | 131 | | |
119 | 132 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
126 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
127 | 150 | | |
128 | 151 | | |
129 | 152 | | |
130 | 153 | | |
131 | 154 | | |
132 | 155 | | |
133 | | - | |
| 156 | + | |
134 | 157 | | |
135 | 158 | | |
| 159 | + | |
136 | 160 | | |
137 | 161 | | |
138 | 162 | | |
| |||
255 | 279 | | |
256 | 280 | | |
257 | 281 | | |
258 | | - | |
259 | 282 | | |
260 | 283 | | |
261 | 284 | | |
| |||
282 | 305 | | |
283 | 306 | | |
284 | 307 | | |
| 308 | + | |
285 | 309 | | |
286 | 310 | | |
| 311 | + | |
287 | 312 | | |
288 | 313 | | |
289 | 314 | | |
| |||
306 | 331 | | |
307 | 332 | | |
308 | 333 | | |
309 | | - | |
310 | | - | |
311 | 334 | | |
312 | 335 | | |
313 | 336 | | |
| |||
329 | 352 | | |
330 | 353 | | |
331 | 354 | | |
| 355 | + | |
332 | 356 | | |
333 | 357 | | |
334 | 358 | | |
335 | 359 | | |
336 | 360 | | |
337 | 361 | | |
338 | 362 | | |
| 363 | + | |
339 | 364 | | |
340 | 365 | | |
341 | 366 | | |
| |||
345 | 370 | | |
346 | 371 | | |
347 | 372 | | |
348 | | - | |
349 | 373 | | |
350 | 374 | | |
351 | 375 | | |
352 | 376 | | |
353 | 377 | | |
354 | 378 | | |
| 379 | + | |
355 | 380 | | |
356 | 381 | | |
357 | 382 | | |
| |||
0 commit comments