From 9327264f18e48a67eada4d589c57c7df364d3632 Mon Sep 17 00:00:00 2001 From: Eugene Fox Date: Thu, 14 May 2026 08:26:11 +0000 Subject: [PATCH] Fixed incorrect OTP config validation --- libraries/SimpleOTP/OtpConfig/OtpConfig.Static.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/SimpleOTP/OtpConfig/OtpConfig.Static.cs b/libraries/SimpleOTP/OtpConfig/OtpConfig.Static.cs index 7112c0c..b24fd41 100644 --- a/libraries/SimpleOTP/OtpConfig/OtpConfig.Static.cs +++ b/libraries/SimpleOTP/OtpConfig/OtpConfig.Static.cs @@ -114,12 +114,12 @@ public partial record class OtpConfig if (format.HasFlag(OtpUriFormat.Yubico)) { - if (config.Type == OtpType.Totp && config.Period is not 15 or 30 or 60) + if (config is { Type: OtpType.Totp, Period: not (15 or 30 or 60) }) errors.Add($"- '{nameof(config.Period)}' must be 15, 30 or 60."); } // Check for digits value - if (config.Digits is not 6 or 8) + if (config.Digits is not (6 or 8)) { // Now it's time for IBM and Yubico to be weird if (format.HasFlag(OtpUriFormat.IBM) && config.Digits is not 7 and not 9)