Clean up login modal in Connect after changes to MFA prompts#47883
Merged
Clean up login modal in Connect after changes to MFA prompts#47883
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Member
Author
|
@gzdunek @kiosion @ryanclark I'd like to ship it before the test plan starts if possible. Despite the number of changed lines, the actual changes are rather simple, but I renamed a bunch of stuff hence the numbers. |
7cf5b93 to
3854df3
Compare
gzdunek
approved these changes
Oct 24, 2024
Comment on lines
+22
to
+24
| transparentBackground = false, | ||
| absolute = true, | ||
| hidden = false, |
Contributor
There was a problem hiding this comment.
Cool that we don't need a type at all 👍
Member
Author
There was a problem hiding this comment.
Yeah, though idk how good that is. If someone wants to add, say, an enum prop in the future, they'll have to add the whole type anyway instead of just adding one line to an existing type. ;f
ryanclark
approved these changes
Oct 24, 2024
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #47322.
What needed fixing
Before #47153, the way MFA with Webauthn worked in Connect was that after submitting the credentials, the login form would immediately shift to prompting you for a key tap. Underneath, tshd would initiate appropriate calls to actually prompt the key tap. The actual key tap was handled through tsh with a regular CLI prompt. The Electron app was just masquerading as if it was somehow done through the Electron app and not tsh.
#47153 made it so that the CLI prompt is no longer used. The login procedure still goes through tsh, but when tsh is about to prompt the key tap, it sends an RPC to the Electron app. The Electron app then shows another modal (on top of the login modal, there's a bit of tech debt there) to ask for a key tap.
Now, as you can see in the recording in the issue closed by this PR, #47322, this introduced a bit of redundancy. The login modal would immediately ask you for key tap and then after a short delay another modal would show up asking for a tap.
How it was fixed
I noticed in
useClusterLoginthat we'd always dosetWebauthnLogin({ prompt: 'tap' });withinonLoginWithLocal. Before the prompt changes, it was guarded by a check for MFA method:teleport/web/packages/teleterm/src/ui/ClusterConnect/ClusterLogin/useClusterLogin.ts
Lines 76 to 84 in b613f70
The check was removed in #47153, causing any kind of local MFA to immediately switch to prompting for a key after credentials were submitted, followed by being overlaid with another modal asking for the proper MFA method.
I removed the call to
setWebauthnLoginfrom there completely and adjusted<FormLocal>so that it shows a progress bar while processing. Previously it'd only disable the fields.I couldn't remove
<PromptWebauthn>, as the passwordless flow still uses it for its own prompts. But since<PromptWebauthn>was no longer used for anything other than passwordless login, I renamed it to<PromptPasswordless>. Similarly, I renamedwebauthnLogintopasswordlessLoginState, followed by a couple of similar renames to related values and types.I verified that the passwordless flow and the new PIV prompts work correctly after those changes.
A couple of nice things about the new implementation:
Demo
Before:
login-mfa.mov
After:
after.mov