Skip to content

Commit

Permalink
Properly handling passwords that are longer than 64 characters. Anyth…
Browse files Browse the repository at this point in the history
…ing longer than 64 characters will be truncated before attempting to login
  • Loading branch information
tpill90 committed Dec 20, 2024
1 parent 8ab735d commit 17a85b1
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 17a85b1

Please sign in to comment.