mirror of
https://github.com/XFox111/SimpleOTP.git
synced 2026-07-02 19:52:42 +03:00
Fixed incorrect OTP config validation
This commit is contained in:
@@ -114,12 +114,12 @@ public partial record class OtpConfig
|
|||||||
|
|
||||||
if (format.HasFlag(OtpUriFormat.Yubico))
|
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.");
|
errors.Add($"- '{nameof(config.Period)}' must be 15, 30 or 60.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for digits value
|
// 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
|
// Now it's time for IBM and Yubico to be weird
|
||||||
if (format.HasFlag(OtpUriFormat.IBM) && config.Digits is not 7 and not 9)
|
if (format.HasFlag(OtpUriFormat.IBM) && config.Digits is not 7 and not 9)
|
||||||
|
|||||||
Reference in New Issue
Block a user