Skip to content

Commit

Permalink
Merge pull request #395 from /issues/380-PasswordTooLong
Browse files Browse the repository at this point in the history
  • Loading branch information
tpill90 authored Dec 20, 2024
2 parents 8ab735d + 17a85b1 commit 575684b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions SteamPrefill/Extensions/MiscExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ public static void Shuffle<T>(this IList<T> list)

public static async Task<string> ReadPasswordAsync(this IAnsiConsole console, string promptText = null)
{
var promptTask = Task.Run(() =>
// Wrapping the prompt in a task so that we can add a timeout if the user doesn't enter a password
Task<string> promptTask = Task.Run(() =>
{
var defaultPrompt = $"Please enter your {Cyan("Steam password")}. {LightYellow("(Password won't be saved)")} : ";
return console.Prompt(new TextPrompt<string>(promptText ?? defaultPrompt)
var password = console.Prompt(new TextPrompt<string>(promptText ?? defaultPrompt)
.PromptStyle("white")
.Secret());

// For whatever reason Steam allows you to enter as long of a password as you'd like, and silently truncates anything after 64 characters
return password.Substring(0, 64);
});
return await promptTask.WaitAsync(TimeSpan.FromSeconds(30));
}
Expand Down

0 comments on commit 575684b

Please sign in to comment.