From 032ffe75f46c7f00b64e975b13cb894527a1184c Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 23 Dec 2024 20:23:25 -0500 Subject: [PATCH] Do not display invalid credentials on empty --- CHANGELIST.md | 1 + MPF.CLI/Program.cs | 19 +++++++++++-------- MPF.Check/Program.cs | 19 +++++++++++-------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 1f96d28f..2be54e91 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -130,6 +130,7 @@ - Use internal options instead of external - Use Invoke explicitly for delegates - Wrap log compression in a thread +- Do not display invalid credentials on empty ### 3.2.4 (2024-11-24) diff --git a/MPF.CLI/Program.cs b/MPF.CLI/Program.cs index 4d26140a..2ba401b8 100644 --- a/MPF.CLI/Program.cs +++ b/MPF.CLI/Program.cs @@ -47,16 +47,19 @@ namespace MPF.CLI } // Validate the supplied credentials - bool? validated = RedumpClient.ValidateCredentials(options.RedumpUsername ?? string.Empty, options.RedumpPassword ?? string.Empty).GetAwaiter().GetResult(); - string message = validated switch + if (!string.IsNullOrEmpty(options.RedumpUsername) && !string.IsNullOrEmpty(options.RedumpPassword)) { - true => "Redump username and password accepted!", - false => "Redump username and password denied!", - null => "An error occurred validating your credentials!", - }; + bool? validated = RedumpClient.ValidateCredentials(options.RedumpUsername!, options.RedumpPassword!).GetAwaiter().GetResult(); + string message = validated switch + { + true => "Redump username and password accepted!", + false => "Redump username and password denied!", + null => "An error occurred validating your credentials!", + }; - if (!string.IsNullOrEmpty(message)) - Console.WriteLine(message); + if (!string.IsNullOrEmpty(message)) + Console.WriteLine(message); + } // Process any custom parameters int startIndex = 2; diff --git a/MPF.Check/Program.cs b/MPF.Check/Program.cs index ca9679ec..9d4ca396 100644 --- a/MPF.Check/Program.cs +++ b/MPF.Check/Program.cs @@ -69,16 +69,19 @@ namespace MPF.Check } // Validate the supplied credentials - bool? validated = RedumpClient.ValidateCredentials(options.RedumpUsername ?? string.Empty, options.RedumpPassword ?? string.Empty).GetAwaiter().GetResult(); - string message = validated switch + if (!string.IsNullOrEmpty(options.RedumpUsername) && !string.IsNullOrEmpty(options.RedumpPassword)) { - true => "Redump username and password accepted!", - false => "Redump username and password denied!", - null => "An error occurred validating your credentials!", - }; + bool? validated = RedumpClient.ValidateCredentials(options.RedumpUsername!, options.RedumpPassword!).GetAwaiter().GetResult(); + string message = validated switch + { + true => "Redump username and password accepted!", + false => "Redump username and password denied!", + null => "An error occurred validating your credentials!", + }; - if (!string.IsNullOrEmpty(message)) - Console.WriteLine(message); + if (!string.IsNullOrEmpty(message)) + Console.WriteLine(message); + } // Loop through all the rest of the args for (int i = startIndex; i < args.Length; i++)