mirror of
https://github.com/gravitational/teleport.git
synced 2026-09-24 16:17:11 +08:00
This changes prompt.ContextReader in the following ways: Reads only happen as a response to Read methods being called. This allows ContextReader to coexist with other readers as long as no reads are abandoned. ReadPassword is now available, the underlying implementation being term.ReadPassword. An abandoned password read may be turned into a clean read. This gives us some UX flexibility when callers abandon password reads (looking at you, PromptMFAChallenge). Turning clean reads into password reads is not supported. It's tricky and I have a few ideas, but it's not paramount at this moment. This solves the woes caused by abandoned OTP reads followed by PIN reads in different packages, such as client.PromptMFAChallenge followed by tsh mfa add's implementation. #9160 * Move ContextReader to its own file * Refactor ContextReader and implement ReadPassword * Test ReadPassword * Fix typos * Remove prompt.StdinSync() prompt.Stdin() has the same behavior for non-abandoned reads. * Group /x/term methods under a type