Commit 5801927
authored
Fix: connectionResolver receives incorrect field value when switching between Login and Sign-up tabs (#2697)
### Changes
Fixes a bug where connectionResolver callback receives the wrong field
value when users switch between Login and Sign-up tabs that have
different field types (username vs email).
Closes #2631
### Root Cause
The bug was in `src/ui/box/container.jsx` in the
`checkConnectionResolver()` method at line 80:
**BEFORE** (buggy code)
`const userInputValue = c.getFieldValue(lock, 'username') ||
c.getFieldValue(lock, 'email');
`
This code always prioritized the username field over email, regardless
of which screen (Login vs Sign-up) was currently active. Since both
field values exist in the global lock state, it would retrieve the Login
username even when on the Sign-up screen.
### Solution
Modified checkConnectionResolver() to check which screen is currently
active and prioritize the appropriate field:
**AFTER** (fixed code)
```
const isSignUpScreen = screenName && screenName.includes('signUp');
const userInputValue = databaseUsernameValue(lock, isSignUpScreen ? {
emailFirst: true } : {});
```
### Testing
Manual testing performed -
- Verified bug exists in original code
- Applied fix and verified bug is resolved
- Tested multiple scenarios:
- Sign-up with email (email prioritized)
- Sign-up with username only (username used)
- Login with username (username prioritized)
- Login with email (email used)
- Switch from Login to Sign-up with pre-filled fields (correct field used)
### Checklist
* [x] I have read the [Auth0 general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)
* [x] I have read the [Auth0 Code of Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)
* [x] All code quality tools/guidelines have been run/followed
* [x] All relevant assets have been compiled1 parent e9779d2 commit 5801927
2 files changed
+71
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| 82 | + | |
78 | 83 | | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
82 | 92 | | |
83 | 93 | | |
84 | 94 | | |
85 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
86 | 101 | | |
87 | 102 | | |
88 | 103 | | |
| |||
110 | 125 | | |
111 | 126 | | |
112 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
113 | 176 | | |
114 | 177 | | |
115 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | | - | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
80 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
| |||
0 commit comments