Misc fix against case-sensitivity for 2fafinalized

This commit is contained in:
Łukasz Domeradzki
2024-07-26 16:20:31 +02:00
parent 40d5fe75e7
commit 8bbff388d2

View File

@@ -251,7 +251,11 @@ internal static class Commands {
if (!string.IsNullOrEmpty(activationCode)) {
string? generatedCode = await mobileAuthenticator.GenerateToken().ConfigureAwait(false);
if (generatedCode != activationCode) {
if (string.IsNullOrEmpty(generatedCode)) {
return bot.Commands.FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, nameof(generatedCode)));
}
if (!generatedCode.Equals(activationCode, StringComparison.OrdinalIgnoreCase)) {
return bot.Commands.FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, $"{generatedCode} != {activationCode}"));
}
}