Commit fcd9534
authored
Add email spellchecker suggestions to login (#73)
### What are the relevant tickets?
<!--- If it fixes an open issue, please link to the issue here. -->
<!--- Closes # --->
<!--- Fixes # --->
<!--- N/A --->
- mitodl/hq#9336
### Description (What does it do?)
<!--- Describe your changes in detail -->
The aim is to prevent profile registrations in Keycloak for MIT users
that are not linked to the organization indentity provider.
#70 added email
spellchecker suggestions to the registration page. This PR adds it on
the login page.
On the registration page, blocks sign ups for MIT emails
([these](https://github.com/mitodl/ol-infrastructure/blob/a0d3000743e198c6a8c91d5a8c87d64de553e15e/src/ol_infrastructure/substructure/keycloak/olapps.py#L672-L688))
by disabling the submit button. The login page ensures the email is
valid and provides suggestions for misspellings, so it should be unusual
for MIT users to reach the registration screen, however this ensures
that MIT users cannot create an account that is not linked to the org
identity. Displays message: "Please return to login to be directed to
MIT Touchstone."
Updates to a more robust email validation regex on the login page.
**Extra care should be taken when testing on RC as this impacts login
and registration.**
### Screenshots (if appropriate):
<!--- optional - delete if empty --->
<img width="647" height="557" alt="image"
src="https://github.com/user-attachments/assets/135cb0aa-42f8-4d8c-9fca-51e16fbf54e0"
/>
<img width="744" height="1007" alt="image"
src="https://github.com/user-attachments/assets/7c018bea-469a-486b-ab44-707333150fe2"
/>
### How can this be tested?
<!---
Please describe in detail how your changes have been tested.
Include details of your testing environment, any set-up required
(e.g. data entry required for validation) and the tests you ran to
see how your change affects other areas of the code, etc.
Please also include instructions for how your reviewer can validate your
changes.
--->
### Additional Context
<!--- optional - delete if empty --->
<!--- Please add any reviewer questions, details worth noting, etc. that
will help in
assessing this change. --->
Run `yarn start` to fire up Keycloak. Navigate to the dummy client at
https://my-theme.keycloakify.dev/.
On the login screen:
- Suggestions should appear as you type misspellings (on blur will often
only happen as the user submits the form).
- Check suggestion is not provided if the email is not yet valid.
- Check suggestions are not provided while correctly typing an MIT
email.
- Check suggestion is provided for close match typos for MIT emails.
These are:
- mit.edu
- broad.mit.edu
- cag.csail.mit.edu
- csail.mit.edu
- education.mit.edu
- ll.mit.edu
- math.mit.edu
- med.mit.edu
- media.mit.edu
- mitimco.mit.edu
- mtl.mit.edu
- professional.mit.edu
- sloan.mit.edu
- smart.mit.edu
- solve.mit.edu
- wi.mit.edu
- Check suggestions are not provided while correctly typing a common
email domain.
- Check suggestion is provided for close match typos for common email
domains, e.g.:
- gmail.com
- yahoo.com
- outlook.com
- hotmail.com
- live.com
- The email validation should disallow:
- `a@b.c` - TLD is only 1 letter
- `user@abc..com` - consecutive dots
- `user@sub..domain.com` - consecutive dots
- `user@-abc.com` leading hyphen
- `user@abc-.com` trailing hyphen
- `user@-sub-domain.com` - leading hyphen
- `a b@example.com` - space in local part
- `user@exa mple.com` - space in domain
- `user@@example.com` - double @
- `user@.example.com` - empty subdomain
- `user@example.` - empty TLD
- `user@example.c1` - TLD must be letters only
On the registration screen:
- If your local Keycloak config doesn't take you to the registration
page, log `kcContext.url.registrationUrl` and open at that path.
- Check that the registration page disables submit for any of the MIT
emails above.
- Message should read "Please return to login to be directed to MIT
Touchstone." on blur.
<!--- Uncomment and add steps to be completed before merging this PR if
necessary
### Checklist:
- [ ] e.g. Update secret values in Vault before merging
--->1 parent 50055e4 commit fcd9534
File tree
6 files changed
+183
-28
lines changed- src/login
- pages
6 files changed
+183
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
17 | 28 | | |
18 | | - | |
19 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
20 | 35 | | |
21 | 36 | | |
22 | 37 | | |
| |||
31 | 46 | | |
32 | 47 | | |
33 | 48 | | |
34 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
35 | 58 | | |
36 | 59 | | |
37 | 60 | | |
| |||
235 | 258 | | |
236 | 259 | | |
237 | 260 | | |
| 261 | + | |
238 | 262 | | |
239 | 263 | | |
240 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
241 | 277 | | |
242 | 278 | | |
243 | 279 | | |
| |||
318 | 354 | | |
319 | 355 | | |
320 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
321 | 362 | | |
322 | 363 | | |
323 | 364 | | |
| |||
353 | 394 | | |
354 | 395 | | |
355 | 396 | | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
| 397 | + | |
| 398 | + | |
374 | 399 | | |
375 | 400 | | |
376 | 401 | | |
377 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
378 | 405 | | |
379 | 406 | | |
380 | 407 | | |
| 408 | + | |
381 | 409 | | |
382 | 410 | | |
383 | 411 | | |
| |||
390 | 418 | | |
391 | 419 | | |
392 | 420 | | |
| 421 | + | |
393 | 422 | | |
394 | 423 | | |
395 | 424 | | |
396 | 425 | | |
397 | 426 | | |
398 | 427 | | |
399 | 428 | | |
| 429 | + | |
| 430 | + | |
400 | 431 | | |
401 | 432 | | |
402 | 433 | | |
| |||
428 | 459 | | |
429 | 460 | | |
430 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
431 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
432 | 471 | | |
433 | 472 | | |
434 | 473 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | | - | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
50 | 75 | | |
51 | 76 | | |
52 | 77 | | |
| |||
104 | 129 | | |
105 | 130 | | |
106 | 131 | | |
| 132 | + | |
107 | 133 | | |
108 | 134 | | |
109 | 135 | | |
| |||
134 | 160 | | |
135 | 161 | | |
136 | 162 | | |
| 163 | + | |
137 | 164 | | |
138 | 165 | | |
139 | 166 | | |
140 | 167 | | |
141 | 168 | | |
142 | 169 | | |
143 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
144 | 174 | | |
145 | 175 | | |
146 | 176 | | |
| |||
152 | 182 | | |
153 | 183 | | |
154 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
155 | 192 | | |
156 | 193 | | |
157 | 194 | | |
| |||
161 | 198 | | |
162 | 199 | | |
163 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
164 | 213 | | |
165 | 214 | | |
166 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
10 | 21 | | |
11 | 22 | | |
12 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
13 | 26 | | |
14 | 27 | | |
15 | 28 | | |
| |||
32 | 45 | | |
33 | 46 | | |
34 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
35 | 53 | | |
36 | 54 | | |
37 | 55 | | |
| |||
54 | 72 | | |
55 | 73 | | |
56 | 74 | | |
| 75 | + | |
57 | 76 | | |
58 | 77 | | |
59 | 78 | | |
| |||
87 | 106 | | |
88 | 107 | | |
89 | 108 | | |
90 | | - | |
| 109 | + | |
91 | 110 | | |
92 | 111 | | |
93 | 112 | | |
| |||
0 commit comments